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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:15:29+00:00 2026-05-29T23:15:29+00:00

This is an already posted question but I need to understand what is going

  • 0

This is an already posted question but I need to understand what is going on with the following scenario. I’m developing an iPad application and I created a UINavigationController like the following (test purposes).

UINavigationController* navigationController = [[UINavigationController alloc] init];        
navigationController.view.backgroundColor = [UIColor redColor];

Once created, I added the UINavigationController‘s view as a subview of a UIViewController.

[self.view addSubview:navigationController.view];

The result is displayed in the following image:

enter image description here

As you can see, there is a gap between the status bar and the navigation bar of the UINavigationController. Since the view of the UINavigationController is red, it seems that the frame of the navigation bar has that gap.

I’ve found an hack to fix the problem. By setting the frame for the UINavigationController, the navigation bar goes in the right position.

CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
CGRect frameRect = CGRectMake(navigationController.view.frame.origin.x, navigationController.view.frame.origin.y - statusBarFrame.size.height, navigationController.view.frame.size.width, navigationController.view.frame.size.height);

navigationController.view.frame = frameRect;

Now, since I don’t like very much that hack and I would understand what is going on, do you have any suggestions to find an elegant solution to resolve the problem?

Thank you in advance.

  • 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-29T23:15:31+00:00Added an answer on May 29, 2026 at 11:15 pm

    That 20px offset is for status bar, navigation controller is designed to be full-screen, but you are adding it to the subview of the main view.

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

Sidebar

Related Questions

I know this question was already posted in StackOverflow but I either didnt understand
I have already posted a question about this, but the situation has changed sufficiently
I have already posted another question about this, but no one seemed to know
I've already posted this question on the authors website , but I thought I
There's a question on this already (here) . But I'm hoping that because I'm
First of all there is probably a question like this already but i couldn't
I already posted a question about this ( Abandoned instances that will not continue
I already posted the following Question got a solution and moving forward I am
I need help to rewrite my URL, already user posted this kind similar questions
I already posted a similar question but i got told to try and solve

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.