ios wantFullScreenLayout状态栏可见 [英] ios wantsFullScreenLayout statusbar visible

查看:732
本文介绍了ios wantFullScreenLayout状态栏可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了以下问题,我试图呈现一个modalViewController并让它覆盖整个屏幕,例如:

I'm facing the following problem, I trying to present a modalViewController and make it cover the entire screen, for example:

[controller setWantsFullScreenLayout:yes];
[myNavController presentModalViewController:controller animated:yes];

结果是控制器没有覆盖整个屏幕,状态栏显示在顶部。
我真的不明白为什么会这样。

the result is that the controller does not cover the entire screen and the status bar is visible on top. I don't really understand why this happens.

推荐答案

wantsFullScreenLayout 属性不会隐藏状态栏,它会使视图控制器在它后面布局(并且还会在导航栏之类的东西后面布局)。一个例子是内置的照片应用程序,其中图片显示在状态和导航栏后面:

The wantsFullScreenLayout property does not hide the status bar, it makes the view controller get layed out behind it (and also get layed out behind things like navigation bars). An example of this is the built-in Photos app, where a picture appears behind the status and navigation bar:

要使模态视图控制器全屏,您需要设置 <$您的视图控制器的c $ c> modalPresentationStyle 属性为 UIModalPresentationFullScreen 。启用此功能后,您可能不需要或不想设置 wantsFullScreenLayout

To make a modal view controller full screen you need to set the modalPresentationStyle property of your view controller to UIModalPresentationFullScreen. With this enabled, you probably don't need or want to set wantsFullScreenLayout.

隐藏状态栏需要使用 setStatusBarHidden:withAnimation: UIApplication 的方法。

To hide the status bar you need to use the setStatusBarHidden:withAnimation: method of UIApplication.

这篇关于ios wantFullScreenLayout状态栏可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆