在iOS 7中,为什么视图高度与iOS 6中的相同视图不同

Xia*_*eng 1 iphone cocoa-touch ios ios7

我有一个视图控制器,它是a的根视图控制器UINavigationController,并且UINavigationController是a的控制器UITabBarViewController

像这样的结构:

UITabBarViewController->UINavigationViewController->UIViewController
Run Code Online (Sandbox Code Playgroud)

但问题是,当我使用这个视图控制器的self.view.frame.size.height属性时,我会得到不同的结果.

在iOS 6中,我得到548.但是在iOS 7中,我得到568.所以我可以准确地放置我的自定义子视图,因为它的位置基于视图的高度.

Dan*_*oad 6

iOS7 views go under the navigation bar, you can stop your views going under the navigation bar in your viewController:

self.edgesForExtendedLayout = UIRectEdgeNone;
Run Code Online (Sandbox Code Playgroud)