full screen background image while using uinavigationcontroller

≡放荡痞女 提交于 2019-12-11 01:38:42

问题


I have an UINavigationController with UINavigationBar hidden = YES.

I want full screen bg for view that embedded in UINavigationController.

But I get only that: http://cs616618.vk.me/v616618797/1bf0d/FEdIn0Nn4x8.jpg

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.


回答1:


Check that all your view controllers are correctly configured:

The UINavigationController:

The rootViewController (inside the UINavigationController):

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 your view controller's code:

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}

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.



来源:https://stackoverflow.com/questions/28251764/full-screen-background-image-while-using-uinavigationcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!