Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8525513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:00:01+00:00 2026-06-11T08:00:01+00:00

According to Apple , I can combine UINavigationController and UITabBarController using the code, e.g.

  • 0

According to Apple, I can combine UINavigationController and UITabBarController using the code, e.g.

MyViewController1* vc1 = [[MyViewController1 alloc] init];
MyViewController2* vc2 = [[MyViewController2 alloc] init];
MyViewController3* vc3 = [[MyViewController3 alloc] init];

MyNavRootViewController* vc4 = [[MyNavRootViewController alloc] init];
UINavigationController* navController = [[UINavigationController alloc]
                        initWithRootViewController:vc4];

NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, vc3, navController, nil];
tabBarController.viewControllers = controllers;

In this setup, only vc4 has the UINavigationController, but what if I want vc1-vc3 also has the UINavigationController?, should I do like..

MyViewController1* vc1 = [[MyViewController1 alloc] init];
UINavigationController* nv1 = [[UINavigationController alloc]
                        initWithRootViewController:vc1];

MyViewController1* vc2 = [[MyViewController2 alloc] init];
UINavigationController* nv2= [[UINavigationController alloc]
                        initWithRootViewController:vc2];

MyViewController1* vc3 = [[MyViewController3 alloc] init];
UINavigationController* nv3 = [[UINavigationController alloc]
                        initWithRootViewController:vc3];


NSArray* controllers = [NSArray arrayWithObjects:nv1, nv2, nv3, nil];
tabBarController.viewControllers = controllers;

Is this the right approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:00:02+00:00Added an answer on June 11, 2026 at 8:00 am
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    
    
    // Override point for customization after application launch.
    
    self.tabBarController = [[[UITabBarController alloc] init] autorelease];
    
     self.tabBarController.viewControllers = [self initializeTabBarItems];
    self.navigationController = [[UINavigationController alloc]init];
    [self.navigationController setNavigationBarHidden:YES];
    self.window.rootViewController = self.navigationController;
    [self.navigationController pushViewController:_tabBarController animated:YES];
    [self.window makeKeyAndVisible];
    return YES;
    }
    - (NSArray *)initializeTabBarItems
    {
    NSArray * retval;
    
    /* Initialize view controllers */
    UIViewController *viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];
    UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease];
    UIViewController *viewController3 = [[[ThirdViewController alloc]initWithNibName:@"ThirdViewController" bundle:nil]autorelease];
    UIViewController *viewController4 = [[[FourthViewController alloc] initWithNibName:@"FourthViewController" bundle:nil] autorelease];
    UIViewController *viewController5  = [[[FivfthViewController alloc] initWithNibName:@"FivfthViewController" bundle:nil] autorelease];
    
    
    /* Initialize navigation controllers */
    UINavigationController * navigationController1 = [[UINavigationController alloc] initWithRootViewController:viewController1];
    UINavigationController * navigationController2 = [[UINavigationController alloc] initWithRootViewController:viewController2];
    UINavigationController * navigationController3 = [[UINavigationController alloc] initWithRootViewController:viewController3];
    UINavigationController * navigationController4 = [[UINavigationController alloc] initWithRootViewController:viewController4];
    UINavigationController * navigationController5 = [[UINavigationController alloc] initWithRootViewController:viewController5];
    
    /*  Release View Controllers */
    [viewController1 release];
    [viewController2 release];
    [viewController3 release];
    [viewController4 release];
    [viewController5 release];
    
    /* Stuff Navigation Controllers into return value */
    retval = [NSArray arrayWithObjects:viewController1,viewController2,viewController3,viewController4,viewController5,nil];
    
    /* Release Navigation Controllers */
    [navigationController1 release];
    [navigationController2 release];
    [navigationController3 release];
    [navigationController4 release];
    [navigationController5 release];
    
    return (retval);
    }
    

    You Can Try This ….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can you combine 2 different conditions using logical OR instead of AND? NOTE:
According to Apple Docs NSCalendar is not thread-safe . How can I ensure thread-safety
According to the Apple UIView Programming Guide, you can only change a uiview's CA
I am using NSInvocationOperation with NSOperationQueue developing in iOS5. According to apple documentation on
According to Apple documentation and other documentation I have read about on disk encryption
According to Apple's description, the aurioTouch sample app is suppose to get the audio
According MSDN, FxCop is an application that analyzes managed code assemblies (code that targets
I have MAC OS 10.6 (Snow Leopard) and according to Apple's guide on HTTP
Actually I have read about that I can write Objective-C app on Linux (using
When converting a NSString to a char* using UTF8String, how to retain it? According

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.