2

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?!

4

1 回答 1

0

视图“iOS 6/7 Deltas”的效果取决于“ Interface Builder Document ”检查器中指定的“ View as ”设置(选择“ View ”->“ Utilities ”->“ Show Utilities ”,然后单击实用程序窗格顶部最左侧的图标,并查看负责的“ Interface Builder Document ”部分的“ View as ”PopUpList)。

调整您的“iOS 6/7 Deltas”以调整当前显示的 iOS 版本(例如,如果您将“查看为”设置为“ iOS7 及更高版本”,请调整“ iOS 6.1 及更早版本”的增量)。

因此,仅当您将“查看为”设置为“ iOS 7.0 及更高版本”时, “-20”的 deltaY 设置才是正确的。一旦您的设置正确,您就可以使用“查看为”PopUpList,您的 VC 将始终看起来正确。

希望这可以帮助。

于 2013-10-01T13:18:13.923 回答