blockCallBack参数也是block的情况
- 对于block想回传出去的点击或者操作事件觉得太过复杂,只是想告诉外界通知确认,而实际操作的内容还是在自己内部完成,就可以使用这一种callback的情况.
- 比如选择皮肤未登录用户需要一键登录之后再判断是否有相应的权限可以领取皮肤的逻辑
self.themeSettingView.goToOneClickLoginCallBack = ^(void (^ _Nonnull callback)(BOOL)) {
[[CYOneClickLoginManager sharedManager] oneClickLoginWithVC:weakSelf loginDelegate:nil isMustBindPhone:YES loginCallBack:^(CYUser * _Nonnull user) {
if (callback) {
callback(YES);
}
}];
};
实现
@property (nonatomic, copy) void (^goToOneClickLoginCallBack)(void (^)(BOOL));
if (weakSelf.goToOneClickLoginCallBack) {
weakSelf.goToOneClickLoginCallBack(^(BOOL isLogin) {
if (isLogin) {
CYThemeSettingModel *model = weakSelf.themeArray[indexPath.row];
[weakSelf clickThemeWithThemeModel:model];
}
});
}
网友评论