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

  • SEARCH
  • Home
  • 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 8620917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:41:46+00:00 2026-06-12T06:41:46+00:00

I have a root view of UINavigationController containing a UITabBarController. The tab bar controller

  • 0

I have a root view of UINavigationController containing a UITabBarController. The tab bar controller has two simple views. When it first launches either in the iOS 6 simulator or on a device, a gap appears above the first view. Switching to the second tab and back causes the gap to disappear. This only started happening since iOS 6. iOS 5 works just fine. Any ideas what changed?

Screenshot:

Screenshot

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    UITabBarController *tabBarController = [[UITabBarController alloc] init];
    UIView *dummyView1 = [[UIView alloc] init];
    [dummyView1 setBackgroundColor:[UIColor redColor]];
    UIViewController *dummyViewController1 = [[UIViewController alloc] init];
    [dummyViewController1 setView:dummyView1];

    UIView *dummyView2 = [[UIView alloc] init];
    [dummyView2 setBackgroundColor:[UIColor blueColor]];
    UIViewController *dummyViewController2 = [[UIViewController alloc] init];
    [dummyViewController2 setView:dummyView2];

    NSArray *viewControllers = [NSArray arrayWithObjects:dummyViewController1, dummyViewController2, nil];

    [tabBarController setViewControllers:viewControllers];

    UINavigationController *rootNavController = [[UINavigationController alloc] initWithRootViewController:tabBarController];
    [[self window] setRootViewController:rootNavController];

    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}
  • 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-12T06:41:47+00:00Added an answer on June 12, 2026 at 6:41 am

    Apple explicitly tells us in I believe the Application Programing Guide (or maybe the ViewController Guide) that a tabBarController should NOT be placed in a navigation controller. You need to reverse the order. You can play tricks with the tabBarController by switching its array of controllers, and having one set hide the tabBar. But any attempt to use the order as you have now is doomed to fail at some point – you may make it work in say iOS5.1, then see it break in 6, 6.1, or 7.

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

Sidebar

Related Questions

I have UINavigationController with UITableViewController as the root view controller. UINavigationController has a an
I have root view with both tab bar and navigation bar visible at the
I have a UINavigationController with a root view controller and then I push a
I have a UINavigationController with a UIViewController (vc1) as the root view controller. There
Ok so basically I have a UITabBarController as my root view controller. I have
I have a root view controller with just a simple navigation button that loads
I have a UITabBarController with 4 views/tabs. Each view is a UINavigationController. How can
I have a UINavigationController , and push from the root view controller to the
i have a view that i initialize in as my root view controller UINavigationController
I have an iPhone app which has a tabBarController as the root view controller

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.