UITableView 实现方法详细说明

- 返回UITableView有多少个分区Sections

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;


- 返回每个分区Sections中有多少行rows

- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;


- 返回 UITableViewCell 对象,每一个cell的布局是什么样子的,简单的可以使用自带的,复杂的可以自己自定义

- (UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;


- 返回每一行的高是多少

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;


- 返回每个分区Section的标题是什么

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;


- 返回每一行的左端缩进级别

- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath;


- 一行被突出显示之前调用,确定用户是否选择了特定的行

- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath;


- 一行被选中后调用,通常用来实现点击一行后的事件响应

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

- 动画渐隐cell被选中的蓝色背景效果

[tableView deselectRowAtIndexPath:indexPathanimated:YES];


- 左右滑动显示右边的删除按钮

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath;


- 在屏幕右侧添加section的字母索引

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView;


- 为右侧的accessoryButton添加点击事件响应

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath;


// 编辑状态下隐藏左侧的圆形删除图标

- (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {

    returnUITableViewCellEditingStyleNone;

}


- 设置是否可以拖动行调整顺序

- (BOOL) tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;


- 行拖动事件响应

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath;


- 设置是否可以编辑TableView的行

- (BOOL) tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;


- 提交删除等编辑事件

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath;




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值