UIViewController生命周期
2018-11-06 本文已影响0人
DavidWongDev
好多文章都写得很含糊,还是自己做一下笔记吧
使用code创建的ViewController
convenience init
super.init(nibName:, bundle:)
loadView
viewDidLoad
viewWillAppear
viewWillLayoutSubviews
viewDidLayoutSubviews
viewDidAppear
使用IB创建的ViewController,加载顺序如下(viewWillLayoutSubviews可能调用多次)
init coder
awakeFromNib
loadView
viewDidLoad
viewWillAppear
viewWillLayoutSubviews
viewDidLayoutSubviews
viewDidAppear