南京市建设局网站,营销型网站制作哪家好,定制开发软件的公司,wordpress 公众号登录2.Cocoa Operation 优点#xff1a;不需要关心线程管理#xff0c;数据同步的事情。Cocoa Operation 相关的类是 NSOperation #xff0c;NSOperationQueue。NSOperation是个抽象类#xff0c;使用它必须用它的子类#xff0c;可以实现它或者使用它定义好的两个子类#…2.Cocoa Operation 优点不需要关心线程管理数据同步的事情。Cocoa Operation 相关的类是 NSOperation NSOperationQueue。NSOperation是个抽象类使用它必须用它的子类可以实现它或者使用它定义好的两个子类NSInvocationOperation 和 NSBlockOperation。 创建NSOperation子类的对象把对象添加到NSOperationQueue队列里执行我们会把我们的执行操作放在NSOperation中main函数中。 1使用NSBlockOperation NSOperationQueue *opq[[ NSOperationQueue alloc] init]; [opq addOperationWithBlock:^{ ,多线程,, }]; 2使用NSInvocationOperation NSOperationQueue *opq[[ NSOperationQueue alloc] init]; NSInvocationOperation *op1[[NSInvocationOperation alloc ] initWithTarget: self selector: selector(thread1) object: nil ]; [opq addOperation : op1]; 转载于:https://www.cnblogs.com/iOS-mt/p/4091438.html