问题描述
我有一个UINavigationController UINavigationBar hidden = YES。
I have an UINavigationController with UINavigationBar hidden = YES.
我希望全屏bg嵌入在UINavigationController中的视图。
I want full screen bg for view that embedded in UINavigationController.
但我只得到:
是否可以在状态栏下全屏显示?
我用独立的视图控制器实现了这一点,但是在UINavigationController中使用它时就像在图像上一样。
Is it possible to make it full screen under status bar?I achieved that with standalone view controller, but while using it in UINavigationController it becomes like on image.
推荐答案
检查所有视图控制器都已正确配置:
Check that all your view controllers are correctly configured:
UINavigationController
:
rootViewController
(在 UINavigationController
内):
以下是我使用上述配置得到的结果和 UIImageView
上的Aspect fill设置:
Here's the result I get using the above configuration and an "Aspect fill" setting on the UIImageView
:
如果您想以编程方式执行此操作,请尝试以下操作:
If you want to do this programmatically, try this:
in y我们的视图控制器代码:
In your view controller's code:
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
您初始化 UINavigationController的位置
(AppDelegate等):
And where you're initializing your UINavigationController
(AppDelegate, etc.):
navController.edgesForExtendedLayout = UIRectEdgeAll;
当然,不要忘记评论或删除可能会干扰这些设置的所有代码行。
Of course, do not forget to comment or remove all lines of code that could interfere with these settings.
这篇关于使用uinavigationcontroller时的全屏幕背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!