Steps:
- List item
- Create a project called Nav.
- Create a new
UIViewControllerBaseViewController (with XIB) and FirstViewController (with XIB). In NavAppDelegat.hspecify the baseController variable
@interface NavAppDelegate : NSObject <UIApplicationDelegate> {
BaseViewController *baseController;
}
@property (nonatomic, retain) IBOutlet BaseViewController *baseController;
In NavAppDelegat.madd baseController to the window:
@synthesize baseController;
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self.window addSubview:baseController.view];
[self.window makeKeyAndVisible];
return YES;
}
Open the BaseViewController.xib file and add UINavigationController, set its root view controller and XIB class to FirstViewController (in the inspector).
- Also connect the variable navigationController with
UINavigationController.
I believe this should show me a FirstViewController with a navigation bar. If I do this directly on MainWindow.xib, everything works as I expected, but here I do not see the navigation bar. What am I missing? thank!
UPDATE:
, UINavigationController (BaseViewController.xib ) MainWindow.xib, .