UITableViewController 的加载方法的逻辑顺序是什么? [英] What is the logical order of load methods of UITableViewController?

查看:25
本文介绍了UITableViewController 的加载方法的逻辑顺序是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当执行 segue 以显示 tableView 时,UITableViewController 的方法的逻辑执行顺序是什么?这是我最好的猜测:

What is the logically executed order of a UITableViewController's methods when a segue is performed to show the tableView? Here is my best guess:

  1. viewWillLayoutSubviews
  2. numberOfSectionsInTableView
  3. numberOfRowsInSection
  4. cellForRowAtIndexPath
  5. heightForRowAtIndexPath
  6. viewDidLoad
  7. viewWillAppear
  8. viewDidAppear

请更正此顺序并添加到其中.

Please correct this ordering and add to it.

推荐答案

这可能对您有所帮助.

  1. viewDidLoad因为它首先加载视图.

viewWillAppear当任何视图再次出现时,就会调用此方法.

viewWillAppear As any view appears again then this method is called.

numberOfSectionsInTableView设置表格中的节数.

numberOfRowsInSection设置节后,此方法确定节中的行数.

numberOfRowsInSection After setting sections,this method determines number of rows in a section.

heightForRowAtIndexPath将设置行的高度.

viewWillLayoutSubviews查看部分标题.

cellForRowAtIndexPathtableview 的单元格的内容和布局就是在这个方法中创建的.

cellForRowAtIndexPath Contents and layout of cell of a tableview is created in this method.

viewDidAppear

这篇关于UITableViewController 的加载方法的逻辑顺序是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆