UITableView回调函数的执行顺序

UITableView 回调函数调用顺序:

1、

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

{

//只加载一次。首先加载的就是这个函数。

}

2、

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

{

//有几个section就会加载几次。

}

3、

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

{

//有几个section就会加载几次。

}

4、

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

{

//每一个section中的row数量只调用一次。

}

5、

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

{

//有多少个row就会调用多少次这个函数。

}

6、

-(UITableViewCell*)tableView:(UITableView *)tableViewcellForRowAtIndexPath:(NSIndexPath *)indexPath

{

//其中6和7交替调用。就是每加载完一个Cell就会调用一次7,7调用结束之后有开始加载6。直到把tableView中的所有cell全部加载完成后,6和7才结束。

}

7、

- (BOOL)tableView:(UITableView *)tableViewcanEditRowAtIndexPath:(NSIndexPath *)indexPath

{

//和6交替调用。

}

8、

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

{

//当所有的Cell加载完后,调用这个函数。有多少个section(Header+ Footer),就会调用多少次该函数。

}

 

总结:首先调用section(row)的个数,然后调用section(row)的高度,最后加载内容(先加载row,后加载section)。

对于一些动作函数(例如点击、移动、删除),当动作发生时调用这些函数。

 

来自 <http://blog.sina.com.cn/s/blog_c1279bc90101b0t6.html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值