29.UITableViewDataSource详解
来源:互联网 发布:python 指数表达 编辑:程序博客网 时间:2024/05/21 17:31
UITableViewDataSource
这节我们介绍UITableViewDataSource, 它用于定义tableView的显示.
下面我们查看它的定义:
public protocol UITableViewDataSource : NSObjectProtocol { // 设置行数 @available(iOS 2.0, *) public func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int // 设置显示的cell @available(iOS 2.0, *) public func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell // 设置分组数, 如果没实现这个方法则是1 @available(iOS 2.0, *) optional public func numberOfSectionsInTableView(tableView: UITableView) -> Int // 指定的section的Header的标题 @available(iOS 2.0, *) optional public func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? // 指定的section的Footer的标题 @available(iOS 2.0, *) optional public func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? // Editing // 指定的indexPath能否编辑行 @available(iOS 2.0, *) optional public func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool // Moving/reordering // 指定的indexPath的行是否能移动 @available(iOS 2.0, *) optional public func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool // Index // 返回右侧的索引标题数组 @available(iOS 2.0, *) optional public func sectionIndexTitlesForTableView(tableView: UITableView) -> [String]? // 告诉tableView section右侧索引对应的标题,如"B",1 @available(iOS 2.0, *) optional public func tableView(tableView: UITableView, sectionForSectionIndexTitle title: String, atIndex index: Int) -> Int // Data manipulation - insert and delete support // 添加/删除后的回调 @available(iOS 2.0, *) optional public func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) // Data manipulation - reorder / moving support // 行移动回调 @available(iOS 2.0, *) optional public func tableView(tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath)}
1 0
- 29.UITableViewDataSource详解
- UITableViewDataSource
- UITableViewDataSource
- UITableViewDataSource
- UITableViewDataSource, UITableViewDelegate
- UITableViewDataSource的方法
- UITableView(三)--- UITableViewDataSource
- UITableViewDataSource的代理方法
- iOS UITableViewDelegate UITableViewDataSource 执行顺序
- id <UITableViewDataSource> dataSource
- 怎样创建表格---UITableView UITableViewDataSource UITableViewDelegate
- 怎样创建表格---UITableView UITableViewDataSource UITableViewDelegate .
- UITableViewDataSource和UITableViewDelegate函数(一)
- UITableViewDataSource 和 UITableViewDelegate协议中常用方法
- Swift UITableView遵从UITableViewDataSource报错问题
- 如何将UITableViewDelegate和UITableViewDataSource从UITableViewController中分离出来?
- 如何将UITableViewDelegate和UITableViewDataSource从UITableViewController中分离出来?
- UITableViewDataSource和UITableViewDelegate内常用的13个方法
- OpenGL碰撞检测与模型运动
- 基于PHP的日历程序
- 对于i=i++的理解
- MySQL 将查询的日期按年月归档
- poj2478 欧拉函数
- 29.UITableViewDataSource详解
- Spring注解学习手札(一)构建web应用
- 单例模式
- int与Integer的区别
- hud——1465不容易系列之一(错排问题)
- 第二次上级报告
- Operating Systems: Three Easy Pieces(操作系统:三个简单方面)4.2进程API
- 数字图像处理
- PHP结合Ajax实现登录验证的Demo