UINavigationController
下viewControllerA
通过pushViewController:animated:
跳转到viewControllerB
- [viewControllerB viewDidLoad]
- [viewControllerA viewWillDisappear:]
- [viewControllerB viewWillAppear:]
- [viewControllerA viewDidDisappear:]
- [viewControllerB viewDidAppear:]
Storyboard下创建的UITabBarController
下面使用tabBarController
表示UITabBarController、subViewController0
表示UITabBarController的第一个子控制器,subViewController1
表示UITabBarController第二个子控制器
调用顺序如下
-[subViewController0 initWithCoder:]
-[subViewController1 initWithCoder:]
-[tabBarController initWithCoder:]
-[tabBarController awakeFromNib]
-[subViewController0 awakeFromNib]
-[subViewController1 awakeFromNib]
-[tabBarController viewDidLoad]
-[subViewController0 viewDidLoad]
-[subViewController0 viewWillAppear:]
-[tabBarController viewWillAppear:]
-[subViewController0 viewDidAppear:]
-[tabBarController viewDidAppear:]
点击TabBarItem切换子控制器时调用顺序如下:
-[subViewController1 viewDidLoad]
-[subViewController1 viewWillAppear:]
-[subViewController0 viewWillDisappear:]
-[subViewController0 viewDidDisappear:]
-[subViewController1 viewDidAppear:]