Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 643
Matt Winters Avatar asked Aug 06 '10 01:08

Matt Winters


People also ask

What is the height of status bar in Android?

Official height is 24dp , as is stated officially by Google on Android Design webpage. Save this answer.

How do I get the status bar?

Show/Hide Status Bar Navigate: From the View menu, select Status Bar.


2 Answers

This issue also occur when user use many other utilities like hotspot. To solve this issue I use following line of code ( as I was myself stuck in this ).

self.tabBarController?.tabBar.autoresizingMask = UIViewAutoresizing(rawValue: UIViewAutoresizing.RawValue(UInt8(UIViewAutoresizing.flexibleWidth.rawValue) | UInt8(UIViewAutoresizing.flexibleTopMargin.rawValue)))

Objective C reference for same issue available here

like image 124
Sahil_Saini Avatar answered Oct 17 '22 03:10

Sahil_Saini


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

like image 32
Ryan Bavetta Avatar answered Oct 17 '22 03:10

Ryan Bavetta