I’m doing the CS193P Stanford course tutorials and also some Apple iOS dev tutorials, and there’s a difference between how they push the ViewController to the screen
Apple does this:
UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
self.navigationController = aNavigationController;
Stanford suggests doing this:
navigationController = [[UINavigationController alloc] init];
[self.navigationController pushViewController:rootViewController animated:NO];
How are they different?
PS: btw, Apple’s method work and the Stanford one doesn’t display anything and I don’t know why.
I think that using the pushViewController:animated method you are going to add the controller at the top of the stack of the controllers (push a new view controller on the stack).
In the second method you are not initializing the navigationController.