1.1.定义
@protocol ChooseCouponDelegate <NSObject>
- (void)tableViewDidSelectCoupon:(HWCouponModel*)coupon;
@end
1.2.属性
@interface HWCouponView : UIView
@property(nonatomic,weak) id<ChooseCouponDelegate>delegate;
@end
1.3.点击事件使用代理通知控制器跳转
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
}
2.1遵守协议
@interface HWCouponController ()<ChooseCouponDelegate>
@end
2.2 设置代理
view.delegate=self;
3.3 实现代理
- (void)tableViewDidSelectCoupon:(CashGiftsModel *)gifts{
}