美文网首页
delegate -UITableViewDataSource数

delegate -UITableViewDataSource数

作者: js_huh | 来源:发表于2020-07-23 11:20 被阅读0次

    是什么?

    • @protocol UITableViewDataSource <NSObject>

    有什么用?

    • - tableView: commitEditingStyle: forRowAtIndexPath:
      • 参数 :
        • tableView:请求插入/删除的表视图对象
        • commitEditingStyle:单元格编辑样式(Delete/Insert), 由对应的指定行来,请求插入或删除。
        • indexPath: 定位行的索引路径.
      • 作用 ?
        • 当用户在表格行中向左/向右滑动时,会检查是否实现了此方法。

          • 如实现, 则会显示"Delete"按钮! 即使方法是空的,也会显示!

          • 前提条件:

            • 对应的行,是可编辑状态。(默认为: 可编辑-YES)
            • - tableView: canEditRowAtIndexPath:
        • 然后,表视图将此消息发送到数据源,要求删除操作。

      • 也可以看看
        • - tableView:titleForDeleteConfirmationButtonForRowAtIndexPath: 代理方法 - 更改删除确认按钮的默认标题.(如: 将Delete,改为 删除 )
        • - tableView: editingStyleForRowAtIndexPath: 自定义单元格的编辑样式。(默认样式: UITableViewCellEditingStyleDelete)
      • 特点 ?
        • 只要自定义了"滑动按钮",那么系统的"删除按钮"则失效!
      • 示例代码来源 ?
        • iOS-MJ-UI基础-大神班/day-10/左滑删除

    什么特点?

    • @required - 必须实现的方法
      - tableView: numberOfRowsInSection: //每组有多少行数据
      - tableView: cellForRowAtIndexPath: // cell显示的内容

    也可以看看

    相关文章

      网友评论

          本文标题:delegate -UITableViewDataSource数

          本文链接:https://www.haomeiwen.com/subject/asbjnhtx.html