UITableViewDelegate Protocol Reference

Configuring Rows for the Table View //配置table的列表

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath //告诉委托指定cell的高度
- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath //告诉委托指定cell的缩进等级
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath //告诉委托如何渲染cell,cell的背景等样式可以在此设置 

 Managing Accessory Views //管理附属图标

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath //当点击cell旁附属图标将触发该方法

Managing Selections //管理被选项

- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath //当cell将被选择时触发,返回nil可阻止当前cell被选中
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath //当cell被选择时触发(变蓝后)
- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath //将被取消选择时触发
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath //被取消选择时触发

Modifying the Header and Footer of Sections //改变section的header和footer

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section //为section设置自定义header,需先设置tableView:heightForHeaderInSection:
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section //为section设置自定义footer
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section //设置section的header高度
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section //设置section的footer高度
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section //设置header视图如何显示,ios6
- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section //设置footer视图如何显示,ios6

Editing Table Rows //编辑行

- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath //将进入编辑模式(通过横扫等方式)
- (void)tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath //将结束编辑模式
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath //设置图标是删除还是增加,默认为删除
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath //修改删除按钮文字
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath //设置进入编辑状态时,Cell是否缩进,默认为YES缩进

Reordering Table Rows //重排表列表

 - (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath //当row移动时触发

Tracking the Removal of Views //追踪移除视图

- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath //当cell被移除时触发,ios6
- (void)tableView:(UITableView *)tableView didEndDisplayingHeaderView:(UIView *)view forSection:(NSInteger)section //当header被移除时触发,ios6
- (void)tableView:(UITableView *)tableView didEndDisplayingFooterView:(UIView *)view forSection:(NSInteger)section //当footer被移除时触发,ios6

Copying and Pasting Row Content //复制和粘贴表内容

- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath //当长按时是否触发复制粘贴菜单,默认为NO
- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender //省略复制和粘贴按钮
- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender //当用户点击复制和粘贴按钮时触发该委托,action为复制或粘贴操作

Managing Table View Highlighting //管理高亮

- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath //告诉委托指定row是否支持高亮,YES是支持,ios6
- (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath //当高亮时触发该委托,ios6
- (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath //当高亮消失时触发该委托,ios6 
posted @ 2013-04-01 16:52  张三的猫  阅读(585)  评论(0编辑  收藏  举报