1.它會調(diào)用代理方法確定有幾行
[TableViewController numberOfSectionsInTableView:]
2.確定每行的表頭高和表尾高(如果設(shè)定了HeardView和FooterView)
[TableViewController tableView:heightForHeaderInSection:]
[TableViewController tableView:heightForFooterInSection:]
3.確定每行有多少的cell
[TableViewController tableView:numberOfRowsInSection:]
4.然后確定每行cell的高度
[TableViewController tableView:heightForRowAtIndexPath:]
-------------如果設(shè)置多行及重復(fù)執(zhí)行以上方法-----------
5.以上信息確定完畢后及調(diào)用代理方法去獲取cell
[TableViewController tableView:cellForRowAtIndexPath:]
6.返回cell的高度
[TableViewController tableView:heightForRowAtIndexPath:]
7.cell將要顯示到屏幕上
[TableViewController tableView:willDisplayCell:forRowAtIndexPath:]
8.cell超出屏幕進行服用時及會調(diào)用兩次
[TableViewController tableView:heightForRowAtIndexPath:]
然后在進行調(diào)用 5 . 6. 7 方法
-[TableController tableView:heightForRowAtIndexPath:] 0
-[TableController tableView:heightForRowAtIndexPath:] 0
-[TableController tableView:cellForRowAtIndexPath:] 0
-[TableController tableView:heightForRowAtIndexPath:] 0
-[TableController tableView:heightForRowAtIndexPath:] 1
-[TableController tableView:heightForRowAtIndexPath:] 1
-[TableController tableView:cellForRowAtIndexPath:] 1
-[TableController tableView:heightForRowAtIndexPath:] 1
-[TableController tableView:heightForRowAtIndexPath:] 2
-[TableController tableView:heightForRowAtIndexPath:] 2
-[TableController tableView:cellForRowAtIndexPath:] 2
-[TableController tableView:heightForRowAtIndexPath:] 2
-[TableController tableView:heightForRowAtIndexPath:] 3
-[TableController tableView:heightForRowAtIndexPath:] 3
-[TableController tableView:cellForRowAtIndexPath:] 3
-[TableController tableView:heightForRowAtIndexPath:] 3
-[TableController tableView:heightForRowAtIndexPath:] 4
-[TableController tableView:heightForRowAtIndexPath:] 4
-[TableController tableView:cellForRowAtIndexPath:] 4
-[TableController tableView:heightForRowAtIndexPath:] 4
-[TableController tableView:heightForRowAtIndexPath:] 5
-[TableController tableView:heightForRowAtIndexPath:] 5
-[TableController tableView:cellForRowAtIndexPath:] 5
-[TableController tableView:heightForRowAtIndexPath:] 5
-[TableController tableView:heightForRowAtIndexPath:] 6
-[TableController tableView:heightForRowAtIndexPath:] 6
-[TableController tableView:cellForRowAtIndexPath:] 6
問題?調(diào)用cell高度的時候會設(shè)置 cell的高度嗎?
-[TableController tableView:heightForRowAtIndexPath:] 19
-[TableController tableView:heightForRowAtIndexPath:] 19
-- setFrame ---
-[TableController tableView:cellForRowAtIndexPath:] 19
-[TableController tableView:heightForRowAtIndexPath:] 19
-- setFrame ---
調(diào)用兩次 heightForRowAtIndexPath 在這只cell 的高度 再次創(chuàng)建 cellForRowAtIndexPath