tableView常用方法

#pragma mark - < UITableViewDelegate>

//点击Cell时调用函数

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

{

NSLog(@"第%zd行",indexPath.row);

}

/**

*取消选中某一行时候调用

*@param indexPath被取消选中那一行《当另一行被选中,前面选中对的行被取消》

*/

- (void)tableView:(UITableView*)tableView didDeselectRowAtIndexPath:(NSIndexPath*)indexPath

{NSLog(@"被取消的第%zd行",indexPath.row);}

*告诉第indexpath行高

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

{if(indexPath.row%2==0) {return20;}

return100;}


在头部分区高度设置

- (CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section

{

return60;

}

分区的头部返回一个UIView

- (UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section

{

return[UIButtonbuttonWithType:UIButtonTypeContactAdd];

}


- (void)scrollViewDidScroll:(UIScrollView*)scrollView

{

NSLog(@"---*********----%@",scrollView);

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容