Ios 在tableView中调用函数numberOfSections的次数是多少?

Ios 在tableView中调用函数numberOfSections的次数是多少?,ios,uitableview,Ios,Uitableview,我有一些简单的代码: class TestTableViewController: UITableViewController { override func numberOfSections(in tableView: UITableView) -> Int { print("toto") return 1 } override func tableView(_ tableView: UITableView, numberOfRo

我有一些简单的代码:

class TestTableViewController: UITableViewController {
    override func numberOfSections(in tableView: UITableView) -> Int {
        print("toto")
        return 1
    }

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
        cell.textLabel?.text = "Hello world"
        return cell
    }
}
我在想,函数
numberOfSections
只被调用了一次,当tableView正在加载或我们请求重新加载时

但在我的控制台中,我有6个“toto”


有人能解释一下他们什么时候进入函数
numberOfSections

加载tableview之前会调用numberOfSections。但当您重新加载数据或删除、插入或更新节和单元格时,也会调用我。您提供的代码不足以说明是什么原因导致numberOfSections被调用6次