I currently have a UITabBar switching between two different views. I want to add a UINavigationBarController to one of the views such that I can programmatically control the title of it.
I have been looking around and I can't seem to figure out how to do this. Could someone point me to a tutorial/source code?
This is what I attempted to do:
AppDelegate.h
Code:
@interface AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UITabBarController *rootController;
UINavigationController * rootNavBar;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *rootNavBar;
@property (nonatomic, retain) IBOutlet UITabBarController *rootController;
@end
AppDelegate.m
Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UINavigationController *navBar = [[UINavigationController alloc] initWithRootViewController:rootController];
[self setRootNavBar:navBar];
// Override point for customization after app launch
[window addSubview:rootController.view];
[window makeKeyAndVisible];
}
It compiles, but it doesn't add a Nav controller to any of the subviews. What am I missing here?