UITableView使用指南

1) 初始化 UITableView对象

– initWithFrame:style: // 代码生成方式,如果你在nib里加的tableview不需要使用这个方法

2)配置TableView

3) 访问Cells和Sections

4) 滚动TableView

5) 管理sections

6) 插入、删除、移动行和sections

7) 管理和编辑cell

8) 重新加载TableView

9) 访问TableView的画图区

10) Registering Nib Objects for Cell Reuse

11) 管理委托和数据源 (重要)

  • dataSource property // 通常会这么用: myTableView.delegate = self; self 为viewController
  • delegate property // 通常会这么用: myTableView.dataSource = self; self 为viewController

另外一个小发现就是:原来当你启用多选的时候,你选中的Cell,UITableViw会自动帮你保存IndexPath到一个数组:

[dataListTableView indexPathsForSelectedRows]

这样你就可以一下子拿到当前选中的Cell

[dataListTableView visibleCells];
[dataListTableView indexPathsForVisibleRows];
原文地址:https://www.cnblogs.com/yjg2014/p/3995293.html