首页 > 其他 > 详细

自定义的cell中如果存在着UIButton,那如何将点击事件传递出去呢?

时间:2016-04-18 13:22:49      阅读:424      评论:0      收藏:0      [点我收藏+]

自定义cell后,将indexPath参数传递到自定义的cell中(NSIndexPath为cell的一个retain的属性),自定义的cell申明一个协议,里面提供了一个方法

- (void)touchEventAtIndexPath:(NSIndexPath *)indexPath;

......

@property (nonatomic, assign) id<AppTableViewCellDelegate>delegate; // 将事件传递出去

......

- (void)buttonsEvent:(UIButton *)button
{
    // 将点击事件传递出去
    [self.delegate touchEventAtIndexPath:_indexPath];
}

当然,也可以用block实现。利用block传递indexPath。

自定义的cell中如果存在着UIButton,那如何将点击事件传递出去呢?

原文:http://www.cnblogs.com/Crazy-ZY/p/5403914.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!