-(void)blockOperation{
NSOperationQueue * queue1 = [[NSOperationQueue alloc]init];
NSBlockOperation* blockOp1 = [NSBlockOperation blockOperationWithBlock:^{
[NSThread sleepForTimeInterval:5];
NSLog(@"blockOperationBegin");
}];
[queue1 addOperation:blockOp1];
//已经添加到NSOperationQueue中的NSBlockOperation,不需要调用start方法开启线程.
// [blockOp1 start];
}
网友评论