同一个block方法的写法:
第一种写法:
typedef void(^ClickSolarTermBlock) (GWHome_SolarTermModel *solarTermModel);
@property (nonatomic, copy) ClickSolarTermBlock clickSolarTermBlock;
第二种写法:
@property (nonatomic, copy) void (^clickSolarTermBlock) (GWHome_SolarTermModel *solarTermModel);
使用:
if (self.clickSolarTermBlock) {
self.clickSolarTermBlock(model);
}
回调:
__weak typeof(self) weakSelf = self;
GWHome_SolarTermsTreeCTRL *solarTermsTreeVC = [[GWHome_SolarTermsTreeCTRL alloc] init];
solarTermsTreeVC.selectSolarTermBlock = ^(GWHome_SolarTermModel * _Nonnull select_solarTermModel) {
weakSelf.solarTermModel = select_solarTermModel;
weakSelf.detailTableHeaderView.solarTermModel = weakSelf.solarTermModel;
[weakSelf.detailTableHeaderView refreshSolarTermsDetailTableHeaderView];
};
[self.navigationController pushViewController:solarTermsTreeVC animated:YES];
网友评论