如何检测双高状态栏? [英] How do I detect a double-height status bar?
问题描述
HIG(第47页)说我必须能够处理在电话或录音期间出现的双倍高度状态栏。
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?
编辑:也许如果有办法获得已知事物的绝对坐标,如导航栏,如果它是+20像素关闭,我会假设双高度状态栏存在。想法?
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?
推荐答案
您可以监控UIApplicationDelegate的这些回调:
You can monitor these call-backs of UIApplicationDelegate:
-
应用程序:willChangeStatusBarFrame:
application:willChangeStatusBarFrame:
application:didChangeStatusBarFrame:
application:didChangeStatusBarFrame:
在iphone模拟器中测试这个很容易:硬件 - >切换通话状态栏
And it's easy to test this in the iphone simulator: Hardware->Toggle In-Call Status Bar
根据您的情况,您的视图及其中的内容可以自动调整大小以适应空间 - 在Interface Builder中检查各种对象上的检查器窗口的查看大小区域
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
这篇关于如何检测双高状态栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!