A storyboard has 3 scenes each with their own UIViewController: vc1, vc2 and vc3. vc1 contains a login button. The login button performs a segue to vc2. vc3 is not connected to vc1 or vc2.
Scenario 1: load the storyboard.
vc1 – loadView
vc1 – viewDidLoad
vc1 – viewWillAppear
vc1 – viewWillLayoutSubviews
vc1 – viewDidLayoutSubviews
vc1 – viewDidAppear
Scenario 2: load the storyboard and press the login button.
vc1 – loadView
vc1 – viewDidLoad
vc1 – viewWillAppear
vc1 – viewWillLayoutSubviews
vc1 – viewDidLayoutSubviews
vc1 – viewDidAppear
vc1 – prepareForSegue
vc2 – loadView
vc2 – viewDidLoad
vc1 – viewWillDisappear
vc2 – viewWillAppear
vc2 – viewWillLayoutSubviews
vc2 – viewDidLayoutSubviews
vc1 – viewWillLayoutSubviews
vc1 – viewDidLayoutSubviews
vc2 – viewDidAppear
vc1 – viewDidDisappear
Scenario 3: In this scenario, in vc2 I changed the viewDidAppear method with the code below and repeated scenario 2.
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear: animated];
NSLog(@"vc2 - viewDidAppear");
ViewController3 *vc3 = [self.storyboard instantiateViewControllerWithIdentifier:@"vc3"];
[self presentViewController:vc3 animated:YES completion:nil];
}
vc1 – loadView
vc1 – viewDidLoad
vc1 – viewWillAppear
vc1 – viewWillLayoutSubviews
vc1 – viewDidLayoutSubviews
vc1 – viewDidAppear
vc1 – prepareForSegue
vc2 – loadView
vc2 – viewDidLoad
vc1 – viewWillDisappear
vc2 – viewWillAppear
vc2 – viewWillLayoutSubviews
vc2 – viewDidLayoutSubviews
vc1 – viewWillLayoutSubviews
vc1 – viewDidLayoutSubviews
vc2 – viewDidAppear
vc1 – viewDidDisappear
vc3 – loadView
vc3 – viewDidLoad
vc2 – viewWillDisappear
vc3 – viewWillAppear
vc1 – viewDidDisappear
vc3 – viewWillLayoutSubviews
vc3 – viewDidLayoutSubviews
vc3 – viewDidAppear
vc2 – viewDidDisappear