Newbie question for iOS — I’m really confused with how navigation view works in a tabview.
Right now I have a tabview that has 2 views. In the second tab I have a button. When the button is clicked I’d like a new window to show up with some information, and the new window needs a Back button on top that goes back to the second tab.
I followed some tutorials and put a NavigationController in secondTab.xib, added the line
@property (nonatomic, retain) IBOutlet UINavigationController *navController;
to secondTab.h, and
NewWindowController *newWindow = [[NewWindowController alloc] initWithNibName:@"NewWindowController" bundle: nil];
[self.navController pushViewController:newWindow animated:YES];
NSLog(@"clicked");
to my button implementation for -(IBAction) click: (id)sender
When I clicked the button in my second tab, the log shows “clicked” but my view is not changing.
Is there some setting I need to change for File’s Owner/Navigation Controller outlets/referencing outlets etc…?
Thanks!
You don’t want a property for the UINavigationController, you want to push onto the current navigation controller like so:
When a UIViewController is associated with a UINavigationController (i.e. it’s part of a navigation controller hierarchy) then its
navigationControllerproperty will be set, so you can access it like I’ve shown.