UIViewController生命周期

好多文章都写得很含糊,还是自己做一下笔记吧

使用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

你可能感兴趣的:(UIViewController生命周期)