zoukankan      html  css  js  c++  java
  • 自定义的cell中如果存在着UIButton,那如何将点击事件传递出去呢?

    自定义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。

  • 相关阅读:
    Web开发规范
    选择器优先级计算
    CSS 技巧
    CSS3滤镜
    CSS3动画
    css3 <3D 转换>
    CSS3 2D 转换
    CSS3文本(text)模型
    CSS3颜色和渐变
    王道8.6
  • 原文地址:https://www.cnblogs.com/Crazy-ZY/p/5403914.html
Copyright © 2011-2022 走看看