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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:16:39+00:00 2026-06-17T07:16:39+00:00

I have been using the method below to get the status bar height. However

  • 0

I have been using the method below to get the status bar height. However I need to get the height when the view loads so I can adjust the height of my tableview accordingly. Using this method in viewDidLoad returns 0.

I have tried using it in viewDidAppear which works, however when I return to the view from a child view (as its part of a nav controller) it takes the height and adjusts it again, every time I return to the view.

So how can I get the height when the view loads to apply this adjustment without running into these issues?

-(CGRect)statusBarFrameViewRect
{
    CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];

    CGRect statusBarWindowRect = [self.view.window convertRect:statusBarFrame fromWindow: nil];

    CGRect statusBarViewRect = [self.view convertRect:statusBarWindowRect fromView: nil];

    return statusBarViewRect;
}

Thanks.

  • 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-17T07:16:40+00:00Added an answer on June 17, 2026 at 7:16 am

    I was able to get the height of both the Status Bar and the Navigation Bar in -viewDidLoad. If you are also transitioning in/out the status bar while loading this new view, you may want to register for UIApplicationWillChangeStatusBarFrameNotification. I can even get the status bar frame in -[appDelegate application:didFinishLaunchingWithOptions:]

    - (void)viewDidLoad
    {
        [super viewDidLoad];
        CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
        // (CGRect) $1 = origin=(x=0, y=0) size=(width=320, height=20)
        CGRect navBarFrame = self.navigationController.navigationBar.frame;
        // (CGRect) $2 = origin=(x=0, y=20) size=(width=320, height=44)
    }
    

    As an aside, I’d expect individual views to not have to care about the status bar, specifically, so this leads me to think you might be using the status bar as an overlay. If that’s the case (Photos.app does this), consider adjusting the contentInset instead of height.

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

Sidebar

Related Questions

I have been trying to get the subgroup total of the data below using
I tried doing it using the method below. However because jQuery has not been
I have been using this copy method for quite a while, in lots of
I have mainly been using the Exists Method for merging a row into a
**Updated: (See below)**I have been looking around for couple of days and can't find
I have been learning Expressions and using the code below to add build up
I have been trying to get the result of a lognormal distribution using Scipy
For about a week now I have been trying to get a view to
I have been using TortoiseSVN for some time and I really like it. I
I have been using Stanford POS Tagger to tag parts of speech in a

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.