Search code examples
iosipadorientationstatusbar

statusBarFrame.height returns 1024.0 when in Landscape (iPad)


I have been using the following code to get the height of the status bar:

[UIApplication sharedApplication].statusBarFrame.size.height

This works perfectly in Portrait mode and returns the expected value (20.0), but when the application is in Landscape, I get the unexpected value of 1024.0 !!

Is anybody able to shed any light on this for me?

iOS version 6.1.3

XCode version 4.6.2


Solution

  • You might need to use the [UIApplication sharedApplication].statusBarFrame.size.width on Landscape orientation. Same as [[UIScreen mainScreen] applicationFrame] gives switched values on Landscape orientation