星空网 > 软件开发 > 操作系统

第三章:IOS Table表视图委托协议和数据协议

表视图有两个重要的协议

UITableViewDataSource :数据源协议

 
方法返回类型说明必须实现
tableView:cellForRowAtIndexPath:



UITableViewCell*



   为表视图单元格提供数据,该方法是必 须实现的方法 







tableView:numberOfRowsInSection:
NSInteger
返回某个节中的行数






tableView:titleForHeaderInSection:
NSString
返回节头的标题






tableView:titleForFooterInSection:
NSString
返回节脚的标题






numberOfSectionsInTableView:
NSInteger
返回节的个数






sectionIndexTitlesForTableView:
NSArray*
提供表视图节索引标题






tableView:commitEditingStyle:forRowAtIndexPath:
void
为删除或修改提供数据






 

UITableViewDelegate :委托协议,主要用来设定表视图中节头和节脚的标题,并响应一些动作事件 

 
方法返回类型说明是否需要实现

tableView:viewForHeaderInSection: 




UIView * 




为节头准备自定义视图,iOS 6之后可以使用 UITableViewHeaderFooterView 




tableView:viewForFooterInSection: 




UIView * 




为节脚准备自定义视图,iOS 6之后可以使用 UITableViewHeaderFooterView 




tableView:didEndDisplayingHeaderView:forSection: 




void 




该方法在节头从屏幕中消失时触发(iOS 6之后 的方法) 




tableView:didEndDisplayingFooterView:forSection: 




void 




当节脚从屏幕中消失时触发(iOS 6之后的方法) 




tableView:didEndDisplayingCell:forRowAtIndexPath: 




void 




当单元格从屏幕中消失时触发(iOS 6之后的方法) 




tableView:didSelectRowAtIndexPath: 




void 




响应选择表视图单元格时调用的方法 




 

 







原标题:第三章:IOS Table表视图委托协议和数据协议

关键词:IOS

IOS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

开发国外客户:https://www.goluckyvip.com/tag/35045.html
开发客户外贸:https://www.goluckyvip.com/tag/35046.html
开发跨境电商:https://www.goluckyvip.com/tag/35047.html
开发区跨境电商培训班:https://www.goluckyvip.com/tag/35050.html
开发外贸客户:https://www.goluckyvip.com/tag/35051.html
开发信英文模板:https://www.goluckyvip.com/tag/35052.html
无锡旅游景点竹海 - 无锡的竹海:https://www.vstour.cn/a/363178.html
5月贾汪好玩的地方 贾汪哪有好玩的地方:https://www.vstour.cn/a/363179.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流