Note that there are some explanatory texts on larger screens.

plurals
  1. POSetting up Navigation Controllers and tabBarController in appDelegate.m
    text
    copied!<p>I just can't for the life of me get a navigation controller (and bar) in each of my tab bar item views. Here is my appdelegate , what am I missing? <code>FrontPage</code> and <code>Opinion</code> are tableviewcontrollers as well, just forgot the table in their names.</p> <pre><code>@implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. FrontPageViewController *frontPageVC = [[FrontPageViewController alloc] initWithNibName:nil bundle:nil]; frontPageVC.title = @"Front Page"; frontPageVC.tabBarItem.image = [UIImage imageNamed:@"second"]; UINavigationController *frontPageNavController = [[UINavigationController alloc] initWithRootViewController:frontPageVC]; CampusTableViewController *campusVC = [[CampusTableViewController alloc] initWithNibName:nil bundle:nil]; campusVC.title = @"Campus"; campusVC.tabBarItem.image = [UIImage imageNamed:@"second"]; UINavigationController *campusNavController = [[UINavigationController alloc] initWithRootViewController:campusVC]; OpinionViewController *opinionVC = [[OpinionViewController alloc] initWithNibName:nil bundle:nil]; opinionVC.title = @"Opinion"; opinionVC.tabBarItem.image = [UIImage imageNamed:@"second"]; UINavigationController *opinionNavController = [[UINavigationController alloc] initWithRootViewController:opinionVC]; SportsTableViewController *sportsVC = [[SportsTableViewController alloc] initWithNibName:nil bundle:nil]; sportsVC.title = @"Sports"; sportsVC.tabBarItem.image = [UIImage imageNamed:@"second"]; UINavigationController *sportsNavController = [[UINavigationController alloc] initWithRootViewController:sportsVC]; PDFViewController *pdfVC = [[PDFViewController alloc] initWithNibName:nil bundle:nil]; NSArray *controllers = [NSArray arrayWithObjects:frontPageVC, campusVC, opinionVC, sportsVC, pdfVC, nil]; self.tabBarController = [[UITabBarController alloc] init]; self.tabBarController.viewControllers = controllers; self.window.rootViewController = self.tabBarController; [self.window makeKeyAndVisible]; return YES; [[self.tabBarController.viewControllers objectAtIndex:0] setRootViewController:frontPageNavController]; } </code></pre> <p>thank you!</p> <p>edit: apparently I need to type more to explain my problem because SO won't let me post without a certain amount of words?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload