自定义方法的自定义完成块
1-定义你自己的自定义块
typedef void(^myCustomCompletion)(BOOL);
2-创建自定义方法,将自定义完成块作为参数
-(void) customMethodName:(myCustomCompletion) compblock{
//do stuff
// check if completion block exist; if we do not check it will throw an exception
if(complblock)
compblock(YES);
}
3-如何在 Method 中使用块
[self customMethodName:^(BOOL finished) {
if(finished){
NSLog(@"success");
}
}];