Domanda

So I have this custom UIViewController subclass, that I present modally with -presentViewController:animated: (NOT pushing it onto a navigation stack). I'm trying to make it play nicely with both iOS 6 and iOS 7.

Said VC is built in a .xib file (no storyboard is involved). I have a custom navigation bar in there, along with some other UI elements. When I run it in iOS 7, I get this:

enter image description here

It looks correct; my custom nag bar correctly abuts the status bar.

However, when I run the same thing in iOS 6, I get:

enter image description here

Notice the black gap (that's the background of the view) between the status bar and my custom nav bar. :(

In the .xib file, I have the view's contents shifted down from the top of the view by 20 pixels; AND I have the view's "iOS 6/7 Deltas" for deltaY set to "-20". It obviously ain't working.

What am I missing here?!

È stato utile?

Soluzione

The effect of a view's "iOS 6/7 Deltas" depends on the 'View as` settings as specified in the 'Interface Builder Document' inspector (select 'View' -> 'Utilities' -> 'Show Utilities', then click on the left-most icon on top of the utilities-pane and look at the responsible 'Interface Builder Document' section's 'View as' PopUpList).

Tweak your "iOS 6/7 Deltas" to adjust for the iOS version that is currently not showing (e.g. if you have set 'View as' to 'iOS7 and later', tweak the deltas for 'iOS 6.1 and Earlier').

Hence, your deltaY settings of "-20" are correct only, if you have set 'View as' to 'iOS 7.0 and Later'. Once your setting are correct, you can play with the 'View as' PopUpList and your VC will always look correct right away.

Hope, this helps.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top