tableView代理方法

iOS UITableView代理方法详解

百般思念 提交于 2019-11-28 23:34:40
iOS UITableView的代理方法详解 一、补充 在上一篇博客中, http://my.oschina.net/u/2340880/blog/404605 ,我将IOS中tableView(表视图)的一些常用方法总结了一下,这篇将tableView的代理方法作了总结,对上一篇博客进行了补充。 二、UITableViewDataSourc(数据源代理) 1、必须实现的回调方法 返回每个分区的行数 - ( NSInteger )tableView:( UITableView *)tableView numberOfRowsInSection:( NSInteger )section; 返回每一行的cell - ( NSInteger )tableView:( UITableView *)tableView numberOfRowsInSection:( NSInteger )section; 2、可选实现的方法 返回分区数(默认为1) - ( NSInteger )numberOfSectionsInTableView:( UITableView *)tableView; 返回每个分区头部的标题 - ( NSString *)tableView:( UITableView *)tableView titleForHeaderInSection:( NSInteger