Here's some reference articles;
Back to Basics - View Controllers
Here is a code sample demonstrating how to push a view controller on to the navigation stack.
// Initialize MyViewController object MyViewController *controller = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:[NSBundle mainBundle]]; // Pushes MyViewController object on the navigation stack [self.navigationController pushViewController:controller animated:YES]; [controller release];
|
Another thing to note is, we release the controller after pushing it on to the stack (prior to iOS5 with ARC). This is because the navigation controller will retain your view controller therefore preventing it from being released from memory.
The following code will pop the view controller off of the view stack with an animation.
[self.navigationController popViewControllerAnimated:YES];
|