我正在尝试了解 NSOperationQueue,并尝试创建最简单的示例。我有以下内容:
NSOperationQueue *myOQ=[[NSOperationQueue alloc] init];
[myOQ addOperationWithBlock:^(void){
NSLog(@"here is something for jt 2");
}];
[myOQ addOperationWithBlock:^(void){
NSLog(@"oh is this going to work 2");
}];
但想这样做:
void (^jt)() = ^void(){
NSLog(@"here is something for jt");
};
void (^cl)() = ^void(){
NSLog(@"oh is this going to work");
};
NSOperationQueue *myOQ=[[NSOperationQueue alloc] init];
[myOQ addOperation:jt];
[myOQ addOperation:cl];
后一种形式可能吗?我可以将块转换为 NSOperation 吗?
提前谢谢