iOS 双层block嵌套的用法
2021-11-09 本文已影响0人
可乐小子
-
(void)setUpModel{
XXModel *model = [XXModel new];__weak typeof(self) weakSelf = self;
model.dodoBlock = ^(NSString *title) {
__strong typeof(self) strongSelf = weakSelf;//第一层 strongSelf.titleLabel.text = title; __weak typeof(self) weakSelf2 = strongSelf; strongSelf.model.dodoBlock = ^(NSString *title2) { __strong typeof(self) strongSelf2 = weakSelf2;//第二层 strongSelf2.titleLabel.text = title2; };
};
self.model = model;
}