Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, you never want to subclass UINavigationController or UITabBarController.</p> <p>Second, I did not quite get what you did, but a correct sequence to create a navigation controller inside a tab bar controller is something like this:</p> <pre><code>// in MyAppDelegate.h UINavigationController *nc1, *nc2; FirstTabRootViewController *vc1; SecondTabRootViewController *vc2; UITabBarController *tbc; // in MyAppDelegate.m nc1 = [[UINavigationController alloc] init]; vc1 = [[FirstTabRootViewController alloc] initWithNibName:nil bundle:nil]; vc1.tabBarItem.title = @"Tab 1"; vc1.tabBarItem.image = [UIImage imageNamed:@"tab1.png"]; vc1.navigationItem.title = "Tab 1 Data"; nc1.viewControllers = [NSArray arrayWithObjects:vc1, nil]; nc2 = [[UINavigationController alloc] init]; vc2 = [[SecondTabRootViewController alloc] initWithNibName:nil bundle:nil]; vc2.tabBarItem.title = @"Tab 2"; vc2.tabBarItem.image = [UIImage imageNamed:@"tab2.png"]; vc2.navigationItem.title = "Tab 2 Data"; nc2.viewControllers = [NSArray arrayWithObjects:vc2, nil]; tbc = [[UITabBarController alloc] init]; tbc.viewControllers = [NSArray arrayWithObjects:nc1, nc2, nil]; </code></pre> <p>Note that it's your view controller that controls the text/icon in the tab bar and in the navigation bar. Create a UINavigationController instance for each of your tabs; UINavigationController contains a stack of view controllers (see viewControllers property) which should contain at least one item — your root controller for that tab. Also create an UITabBarController to manage the tabs.</p> <p>Of course, you can (and probably should) use interface builder instead of code to instantiate the mentioned classes and set the properties. But it's important that you understand what happens behind the scenes; interface builder is nothing more than a convenient way to instantiate and set up objects.</p> <p>Hope this is helpful; please refine your question if it's not.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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