创建UITableView后调用哪个协议方法

很抱歉在这里提出这类简单的问题。

但我是iOS开发的新手:(我也试图谷歌找到我的答案,但我不明白。

我的问题是创建完整的TableView后, UITableView哪个协议方法被调用?

我的意思是当创建UITableView然后调用UITableViewDataSource方法,如,

配置表视图

 – tableView:cellForRowAtIndexPath: required method – numberOfSectionsInTableView: – tableView:numberOfRowsInSection: required method – sectionIndexTitlesForTableView: – tableView:sectionForSectionIndexTitle:atIndex: – tableView:titleForHeaderInSection: – tableView:titleForFooterInSection: 

等等…

但我想知道在没有任何UITableView交互的情况下创建完整的TableView(或调用上面的方法)之后UITableView调用哪个方法?

所以,请帮帮我

由于Apple的文档中没有指定订单,因此您无法安全地假设它们将始终以相同的顺序调用,并且在您的实现中进行此类假设通常不是一个好主意。

例如,不会为所有行调用cellForRowAtIndexPath。 它仅被调用可见行,然后在用户滚动到它们时调用其他行。 旧行在离开屏幕时也会被破坏,如果用户向上滚动,它将再次请求单元格。

但总的来说,我们可以假设一些调用顺序:

 – numberOfSectionsInTableView: (...Optional method...) – sectionIndexTitlesForTableView: (...Optional method...) – tableView:titleForHeaderInSection: (...Optional method...) – tableView:titleForFooterInSection: (...Optional method...) – tableView:numberOfRowsInSection: (...Compulsory method...) – tableView:cellForRowAtIndexPath: (...Compulsory method...) 

为了创建UITable,必须调用所有必需的方法。 即

 – tableView:cellForRowAtIndexPath: – tableView:numberOfRowsInSection: 

当然这些是数据源方法。 但是在创建表之后,在重新加载表之前,这个方法都没有调用。 如果你想要在创建tableview之后调用的方法,你必须寻找委托方法,如:

 – tableView:willSelectRowAtIndexPath: – tableView:didSelectRowAtIndexPath: – tableView:willDeselectRowAtIndexPath: – tableView:didDeselectRowAtIndexPath: