view1 = [[View1 alloc] init]; //Create the first view
UINavigationController *navigationController1 = [[UINavigationController alloc] initWithRootViewController:view1];
navigationController1.navigationBar.tintColor =[UIColor blackColor];
View1 is inherit from UIViewController. So I create a *view1, then I create a UINavigationController, call *navigationController1. How do I link the two together? Thank you very much
The way to link a view controller with a navigation controller is to push the view controller onto the navigation stack. For example:
UIViewController * yourViewController = [[UIViewController alloc] init];
UINavigationController * navigation = [[UINavigationController alloc] init];
[navigation pushViewController:yourViewController animated:NO];
[yourViewController release]
Finally release the view controller at the end since the navigation controller retains it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With