Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think i got the solution:</p> <p>First change your view base application to a navigation based:<br/> This is your standard template for you main nib: <img src="https://i.stack.imgur.com/xbl9x.png" alt="enter image description here"></p> <p>Make it like this:<br/> <img src="https://i.stack.imgur.com/sufIl.png" alt="enter image description here"></p> <p>Add a UINavigationController. Open it and drag the ViewBasedViewController over the existing controller in your UINavigationController.</p> <p>Go to your App Delegate:</p> <pre><code>@interface ViewBasedAppDelegate : NSObject &lt;UIApplicationDelegate&gt; { UIWindow *window; UINavigationController *navController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UINavigationController *navController; @end @synthesize window; @synthesize navController; #pragma mark - #pragma mark Application lifecycle - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self.window addSubview:navController.view]; [self.window makeKeyAndVisible]; return YES; } //Other code omitted @end </code></pre> <p>Link the navController outlet to the navigation controller in your NIB.</p> <p>Make a new class with lets say 'TheTabBarController'.</p> <p>Add this to your view based controller to add the fifth controller:</p> <pre><code>- (IBAction) addFifthView:(id)sender { TheTabBarController *conn = [[TheTabBarController alloc] init]; [self.navigationController pushViewController:conn animated:YES]; [conn release]; } </code></pre> <p>Implement the TheTabBarController like this:</p> <pre><code>@interface TheTabBarController : UITabBarController { } @end @implementation TheTabBarController - (void) viewDidLoad { UIViewController *dummy = [[UIViewController alloc] initWithNibName:@"Dummy" bundle:nil]; dummy.title = @"Dummy title"; dummy.view.backgroundColor = [UIColor redColor]; UIViewController *otherDummy = [[UIViewController alloc] initWithNibName:@"Dummy" bundle:nil]; otherDummy.title = @"Other dummy"; otherDummy.view.backgroundColor = [UIColor blueColor]; [self setViewControllers:[NSArray arrayWithObjects:dummy,otherDummy,nil]]; [dummy release]; [otherDummy release]; } //Other code omitted @end </code></pre> <p>Should work like this.</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