ios push pop 和 present dismiss 跳转的生命周期 (影响navigationController和tabBarController设置)
一 ViewController1 push 到 ViewController2
VC1 viewWillDisappear
VC2 loadView
VC2 viewDidLoad
VC2 viewWillAppear
VC1 viewDidDisappear
VC2 viewDidAppear
二 ViewController2 pop 到 ViewController1
VC2 viewWillDisappear
VC1 viewWillAppear
VC2 viewDidDisappear
VC1 viewDidAppear
VC2 dealloc
三 ViewController1 present 到 ViewController2
ViewController2 loadView
ViewController2 viewDidLoad
ViewController1 viewWillDisappear
ViewController2 viewWillAppear
ViewController2 viewDidAppear
ViewController1 viewDidDisappear
四 ViewController2 dismiss 到 ViewController1
ViewController2 viewWillDisappear
ViewController1 viewWillAppear
ViewController1 viewDidAppear
ViewControlle2 viewDidDisappear
ViewController2 dealloc
建议:
设置尽量在 viewWillAppear,viewWillDisappear