Search code examples
iphonestatusbar

How do I detect a double-height status bar?


The HIG (p.47) says that I have to be able to handle the double-height status bar that appears during phone calls or voice recordings.

How exactly do I handle this situation?

I really only have 1 screen where a keyboard with toolbar over it underlaps a textfield when the double-height status bar shows - on other screens things are just a bit scrunched up but useable.

If I could detect that a double-height status bar exists, I could maybe adjust the placement of the textfields or make them temporarily shorter but is it possible to detect when the double-height status bar is there?

EDIT: Maybe if there were a way to get the absolute coordinates of a known thing, like the nav bar, and if it was +20 pixels off, I'd assume that the double-height status bar is present. Thoughts?

And a secondary question, if this (or anything) works, I'd just like to hide the regular status bar using

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO]

but I don't want to hide both - basically a lazy way not to have to touch any of my screens - if the double is there, make it a single again by hiding the regular status bar. Will the above code hide both?


Solution

  • You can monitor these call-backs of UIApplicationDelegate:

    • application:willChangeStatusBarFrame:

    • application:didChangeStatusBarFrame:

    And it's easy to test this in the iphone simulator: Hardware->Toggle In-Call Status Bar

    Depending on your situation, your views and the things in them can resize automatically to fit the space - check the View Size area of the inspector window in Interface Builder on various objects