iOS中tableview的执行顺序

来源:互联网 发布:车载导航电子狗软件 编辑:程序博客网 时间:2024/05/29 14:55

1.它会调用代理方法确定有几行

numberOfSectionsInTableView:

2.确定每行的表头高和表尾高(如果设定了HeardView和FooterView)

heightForHeaderInSection:
tableView:heightForFooterInSection:

3.确定每行有多少的cell

numberOfRowsInSection:

4.然后确定每行cell的高度

heightForRowAtIndexPath:


如果有多个section和row则循环执行上面的代码


5.以上信息确定完毕后及调用代理方法去获取cell

cellForRowAtIndexPath:

6.返回cell的高度

heightForRowAtIndexPath:

7.cell将要显示到屏幕上

willDisplayCell:forRowAtIndexPath:

8.cell超出屏幕进行服用时及会调用两次

heightForRowAtIndexPath:

然后在进行调用 5 . 6. 7 方法