In the fight against creating my first iPhone app, I noticed that Apple examples have a navigation bar or panel, but never both.
Can this be done?
So I have a panel with three buttons, how can I add a navigation controller to my entire application?
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
UIViewController *activityViewController = [[[ActivityViewController alloc] initWithNibName:@"ActivityViewController" bundle:nil] autorelease];
UIViewController *agendaViewController = [[[AgendaViewController alloc] initWithNibName:@"AgendaViewController" bundle:nil] autorelease];
UIViewController *settingsViewController = [[[SettingsViewController alloc] initWithNibName:@"SettingsViewController" bundle:nil] autorelease];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:activityViewController, agendaViewController, settingsViewController, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
EDIT:
I really don't follow, so in my appdelegate I created a navigation controller and used it as rootViewController.
Then I created a tabBarController and added it to my window
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
UINavigationController *mainViewController = [[UINavigationController alloc] init];
self.mainViewController = [[UINavigationController alloc] initWithRootViewController:mainViewController];
self.window.rootViewController = self.mainViewController;
[self.window makeKeyAndVisible];
self.window.rootViewController.title = @"test";
MainViewController *tabBarController = [[MainViewController alloc] init];
[self.window addSubview:tabBarController.view];
But whenever I start, I get an error
Pressing the navigation controller is not supported
Am I still missing something?
source
share