PerformSegueWithIdentifier and viewDidLoad

MainViewController:

[self performSegueWithIdentifier:@"showNextVC sender:self];

      

Segue Destination Controller:

- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"Show text!");
[self performSegueWithIdentifier:@"showSignUp" sender:self]; }

      

Why isn't the code from the viewDidLoad method of the destination controller executed?

+3


source to share


2 answers


viewDidLoad is called when the ViewController object is created by loading the nib file. It is not yet attached to the window. You have to call performSegue function ... call viewDidAppear.



Finally if you call performSegue function directly without any action. I would suggest that you take a look at the flow again.

+11


source


If you copied and pasted, I would guess because you are missing ", about whom the compiler should have warned you about



if "there try NSLog in your segue preparation and see if it gets called

0


source







All Articles