我想显示一个模态视图,并希望它覆盖 iPhone 的状态栏.
I want to display a modal view, and want it to cover the iPhone's status bar.
我尝试将模态视图控制器的 WantsFullScreenLayout 属性设置为 YES;我还将其父级的属性也设置为 YES.这不起作用,大概是因为模态视图显示在主窗口内容下方,其中包括状态栏.
I tried setting the modal view controller's wantsFullScreenLayout property to YES; I also set its parent's property to YES as well. This doesn't work, presumably because the modal view displays below the main window's content, which includes the status bar.
我的第二种方法放弃了整个wantsFullScreenLayout"技术,转而在模态视图显示之前隐藏状态栏,然后在模态视图关闭后将其重新打开.这一直有效...模式视图的父视图布局不正确(其导航栏部分隐藏在状态栏后面.)调用 -[view setNeedsLayout] 什么都不做.
My second approach dropped the whole "wantsFullScreenLayout" technique in favor of hiding the status bar just before the modal view is displayed, then turning it back on after the modal view is dismissed. This works until the very end...the modal view's parent view is laid out incorrectly (its navigation bar is partially hidden behind the status bar.) Calling -[view setNeedsLayout] does nothing.
我应该如何解决这个问题?
How should I approach this problem?
谢谢.
你会想要 - (void)setStatusBarHidden:(BOOL)hidden animated:(BOOL)animated
在 >UIApplication
类.
You'll be wanting the - (void)setStatusBarHidden:(BOOL)hidden animated:(BOOL)animated
on the UIApplication
class.
类似这样的:
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
这应该用漂亮的淡入淡出动画隐藏状态栏.
That should hide the status bar with a nice fade animation.
这篇关于显示模态视图时使 iPhone 状态栏消失?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!