博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年8月24日

摘要: 链接地址:http://c.gzl.name/archives/137多线程 之 NSOperation2009年06月17日, 7:18 下午T多线程编程是防止主线程堵塞,增加运行效率等等的最佳方法。而原始的多线程方法存在很多的毛病,包括线程锁死等。在Cocoa中,Apple提供了NSOperation这个类,提供了一个优秀的多线程编程方法。本次讲解NSOperation的使用方法:1,将想在另外一个线程的工作单独成类,并设置其父类为NSOperation:@interface ImageLoadingOperation : NSOperation { NSURL *imageURL;... 阅读全文

posted @ 2011-08-24 17:23 星尘的天空 阅读(265) 评论(0) 推荐(0) 编辑

摘要: 下面的代码可以放置在发布版本中包含NSLOG函数如果调试版本,_OPTIMIZE_ 是没有定义的,NSlog会正常的工作如果是发布版本,NSlog不会做任何事情,也就不会消耗系统资源#ifndef _OPTIMIZE_# define NSLog(...) NSLog(_OPTIMIZE_)#else# define NSLog(...) {}#endifTHE END ! 阅读全文

posted @ 2011-08-24 14:30 星尘的天空 阅读(220) 评论(0) 推荐(0) 编辑

摘要: // Override to allow orientations other than the default portrait orientation.- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ return (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight). 阅读全文

posted @ 2011-08-24 08:17 星尘的天空 阅读(334) 评论(0) 推荐(0) 编辑