從結(jié)果可知侨赡,當(dāng)我們?cè)O(shè)置為1個(gè)section分組和一個(gè)每個(gè)section分組的row為2的時(shí)候呐能,顯示出來(lái)一個(gè)UITableView的實(shí)例需要4輪(我這里用numberOfSectionsInTableView:方法做了分割俺驶,所以是4輪):原文鏈接
第一輪~第三輪都是一樣的:
1、先執(zhí)行numberOfSectionsInTableView:一次
2蔬墩、然后執(zhí)行tableView:heightForHeaderInSection:兩次
3篡帕、再執(zhí)行tableView:heightForFooterInSection:兩次
4、再執(zhí)行tableView:numberOfRowsInSection:一次
5次询、最后執(zhí)行tableView:heightForRowAtIndexPath:兩次
第四輪是這樣的:
1腋舌、執(zhí)行numberOfSectionsInTableView:一次
2、執(zhí)行tableView:heightForHeaderInSection:兩次
3渗蟹、執(zhí)行tableView:heightForFooterInSection:兩次
4、執(zhí)行tableView:numberOfRowsInSection:一次
5赞辩、執(zhí)行tableView:heightForRowAtIndexPath:兩次
前5步和前三輪是一樣的
6雌芽、執(zhí)行tableView:cellForRowAtIndexPath:一次
7、執(zhí)行tableView:heightForRowAtIndexPath:一次
8辨嗽、執(zhí)行tableView:willDisplayCell:forRowAtIndexPath:一次
9世落、10、11是重復(fù)6糟需、7屉佳、8。(因?yàn)槭莾蓚€(gè)row)
12洲押、執(zhí)行tableView:viewForHeaderInSection:一次
13武花、執(zhí)行tableView:willDisplayHeaderView:forSection:一次
14、執(zhí)行tableView:viewForFooterInSection:一次
15杈帐、執(zhí)行tableView:willDisplayFooterView:forSection:一次