1:代理
Cell中:
@class F_KResourceTableViewCell;
@protocol F_KResourceDelegate<NSObject>
-(void)editButton:(F_KResourceTableViewCell *)cell andHouseResourceModel:(HouseResourceModel *)model;
@end
点击事件:
-(void)callPhoneEventSender{
if(self.delegate&& [self.delegaterespondsToSelector:@selector(editButton:andHouseResourceModel:)]) {
[self.delegate editButton:self andHouseResourceModel:_f_KModel]; }
}
控制器中:(点击cell的事件 回调给控制器,触发代理方法对应当前model数据传递)
#pragma mark- cell代理方法
-(void)editButton:(F_KResourceTableViewCell *)cellandHouseResourceModel:(HouseResourceModel *)model{
// 调详情接口
[self getOneHouseInfoAndHouseResourceModel:model];
}
2:Block
Cell中:
typedef void(^cardDeleteButtonBlock)(void);
@end
/** block */@property (nonatomic, copy) cardDeleteButtonBlock editBlock;
点击事件:
- (void)editCard:(UIButton*)sender{
if(self.editBlock) {
self.editBlock();
}}
控制器中:(点击cell的事件 回调给cellForRowAtIndexPath 方法中,做赋值)
cell.editBlock= ^{
MCAddXinYongKaController *addVC = [[MCAddXinYongKaController alloc] init];
addVC.cardInfo=self.bankCardDataArr[indexPath.section];
[self.navigationController pushViewController:addVC animated:YES];
};