When I use this line of code in the viewDidLoad of the app’s main viewController, it is just getting completely ignored:
[self presentModalViewController:nextController animated:YES];
The nextControler doesn’t load, nothing at all happens.
I do know the code is being “executed” since I put an NSLog before and after it and also ran through the program with a breakpoint.
When I call this line elsewhere in the code, it works perfectly as expected, but in viewDidLoad it is being ignored.
So I tried this code to see if there would be any difference:
[self.view addSubview:nextController.view];
This is loading the nextController view over top of my main view but some of it is transparent so that the main view shows through, and when I try to click on a button in the nextController, it is actually NSLog’ing as a press on a button in the main view below it.
Does anybody have any idea what might be happening here?
Thanks in advance!
viewDidLoadis called before the view controller is inserted into the view controller hierarchy. That’s why it just doesn’t know how to present a modal view controller at this point. Try moving the code intoviewDidAppear:.