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 344819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:01:33+00:00 2026-05-12T11:01:33+00:00

I have a view that is loaded in the MainWindow.xib. It is just a

  • 0

I have a view that is loaded in the MainWindow.xib. It is just a view with a uiimageview in it that shows a image on the entire screen ( 320 X 480 ). When the app loads I display this view and then I do a

[self.view addSubview:tabbarController.view];

Tab Bar Controller is just a UITabBarController with 2 View Controllers added to it. When it adds the tabbarController’s view to the subview it leaves a gap at the top of about 20px. My app does have a status bar but this is basically room for another. This happens unless I add this to my view controller:

self.view.frame = CGRectMake(0, 0, 320, 480);

Can anyone explain this. I was doing

self.view = tabbarController.view;

but was told I shouldn’t do that. So now I’m adding a subview, but I don’t understand why I have to adjust the CGRect of my view to not show the 20px.

  • 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-05-12T11:01:34+00:00Added an answer on May 12, 2026 at 11:01 am

    UITabBarController expects to have its view added as a subview of UIWindow, not as a subview of some other UIView. The frame property defines the offset of the view within its superview, so the UITabBarController implementation offsets its view’s frame by 20 pixels by default to leave room for the status bar. You’re using UITabBarController in a nonstandard way by adding it to a view that’s already been offset by 20 pixels for the status bar. UITabBarController offsets its view by an additional 20 pixels relative to its superview, causing the gap you see.

    One clean way to fix this is add the UITabBarController’s view as a subview of the window instead of a view:

    [[[UIApplication sharedApplication] keyWindow] addSubview:tabbarController.view];
    

    (Note: The keyWindow method will only return your window if you’ve already called makeKeyAndVisible. Otherwise, you may want to set a window property on your UIViewController.)

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

Sidebar

Related Questions

I have a View-based app. The first view that is loaded has a button
I have a View Controller inside my MainWindow.xib file that loads the nib Cover
I have a view that shows user profile fields in a tabular format. There
I have a web view that is loaded with an HTML that contains links.
I have a regular old iPhone app that has a main view controller that
Here's how I set up my app. I have a root view that loads
HI have a custom view class that is loaded and placed within my main
I have a UISlider as part of a view that is loaded into a
I have a QGraphicsView contains a QGraphicsScene which loaded an image. What my app
I have a view that is pushed onto the Screen via navigation controllers: Inside

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.