Need wantsFullScreenLayout behavior with NON-translucent bars on iOS 7
Asked Answered
M

2

10

I want to be able to have my view cover the whole screen (go behind the navigation and tool bars) with the translucent property of the navigationBar and toolbar set to NO (I want non-transparent bars).

This was easy to accomplish prior to iOS 7 by setting wantsFullScreenLayout to YES. However, in iOS 7, I can't find any way of doing this. Any ideas?

Mountbatten answered 4/10, 2013 at 21:13 Comment(0)
B
34

wantsFullScreenLayout is deprecated at iOS 7. Try setting your view controller's edgesForExtendedLayout property to UIRectEdgeAll

The iOS 7 Transition Guide mentions a few of the new view controller differences on page 17. However, the documentation states that if you're using opaque bars (as in your case) you should also set:

extendedLayoutIncludesOpaqueBars = YES;

EDIT

.. because by default it is NO. This conflicts with the iOS 7 Transition Guide which states the default value is YES. Be warned.

Bovid answered 4/10, 2013 at 21:24 Comment(9)
By default, edgesForExtendedLayout is set to UIRectEdgeAll.Emery
Yes, but it's possible the OP might have adjusted it somewhere along the way.Bovid
Sure. The craze these days around SO is to solve all problems by setting to UIRectEdgeNone instead of understanding the problems and solving them properly. The most annoying answers I see are "just revert to old way by UIRectEdgeNone. Ugh!Emery
BTW, a little off topic, but it seems even Apple solved some of their classes' problems by setting to UIRectEdgeNone. :-)Emery
I got it to work! The solution was to set extendedLayoutIncludesOpaqueBars to YES on the UIViewController. The edgesForExtendedLayout needs to be on UIRectEdgeAll, but that is set by default, so no need to make a change to that. Anyway, if you revise your answer, I will accept it. Thanks for the help.Mountbatten
Its frustrating, I know. You might try looking at your XIB (if you're using one) as well as examining the arrangement of your view hierarchy to ensure that you're setting these properties in the correct place.Bovid
What's weird about your solution is: The Transition Guide states "If you're design uses opaque bars, refine edgesForExtendedLayout by also setting the extendedLayoutIncludesOpaqueBars to NO." You're saying that the opposite is happening. Could be a bug. Not sure.Bovid
I know, they made an error. One minor correction to the last sentence in your answer: the default value of extendedLayoutIncludesOpaqueBars is NO. You can verify this by checking in code, or also reading the doc that comes up in Xcode when you select the property.Mountbatten
You're right. I just double checked the docs! It's conflicting with the transition guide.Bovid
T
-1
picker.edgesForExtendedLayout = YES;
Theis answered 23/10, 2015 at 9:53 Comment(2)
Please extend your answer with description.Staves
edgesForExtendedLayout is a variable of UIRectEdge type, it cannot be YES.Symonds

© 2022 - 2024 — McMap. All rights reserved.