使用块参数调用Objective-C方法

时间:2013-10-01 13:10:36

标签: iphone ios objective-c

怎么称呼这个:

-(BOOL)setCloudEnabledAndOverwriteCloudWithLocalIfConfirmed:(void (^)(void (^setConfirmationAnswer)(BOOL answer)))confirmationBlock 

感谢。

马西莫。

2 个答案:

答案 0 :(得分:1)

[object setCloudEnabledAndOverwriteCloudWithLocalIfConfirmed:^(BOOL answer){
/* do your stuff here */
}];

答案 1 :(得分:1)

BOOL someResult = [instance setCloudEnabledAndOverwriteCloudWithLocalIfConfirmed:^(void(^setConfirmationAnswer)(BOOL answer)){
    // do something if needed
    setConfirmationAnswer(YES);
}];