简体   繁体   English

iPhone 4S / iPad Air屏幕高度

[英]iPhone 4S / iPad Air screen height

I'm developing an iPhone app and I created the views based on the height of the device. 我正在开发iPhone应用程序,并根据设备的高度创建了视图。 So the code to create a view looks like the below. 因此,用于创建视图的代码如下所示。

self.signUpViewController.view.frame = CGRectMake(0.0,0.0,[[UIScreen mainScreen] bounds].size.width,[[UIScreen mainScreen] bounds].size.height);

And my app works fine on iPhone 5, 5S, 6 and 6 plus. 我的应用程序可以在iPhone 5、5S,6和6 plus上正常运行。 However when I run the application on iPhone 4S / iPad Air (320 x 480 - Retina), height of all sub views are 412.0. 但是,当我在iPhone 4S / iPad Air(320 x 480-视网膜)上运行该应用程序时,所有子视图的高度均为412.0。

I inspected the app using Spark and I found that root view controller height is 480.0 however in the view hierarchy the next system view is UILayoutContainer which has a height of 412.0. 我使用Spark检查了该应用程序,发现根视图控制器的高度为480.0,但是在视图层次结构中,下一个系统视图为UILayoutContainer,其高度为412.0。

FYI - This app was designed for 5 and 5S and I'm relying on the iOS auto scaling to make the app work on 6 and 6 plus. 仅供参考-此应用是为5和5S设计的,我依靠iOS自动缩放功能使该应用在6和6 plus上运行。 Could this be causing the issue ? 这可能是造成问题的原因吗?

I'm attaching an image of my view hierarchy that better explains the problem. 我附加了视图层次结构的图像,可以更好地解释问题。

在此处输入图片说明

Any pointers would be greatly appreciated. 任何指针将不胜感激。

Thanks 谢谢

I fixed the issue by setting the autoresizingMask of the navigation controller. 我通过设置导航控制器的autoresizingMask解决了该问题。

For anybody else having the same issue, just set your root navigation controller's autoresizingMask to UIViewAutoresizingNone. 对于其他有相同问题的人,只需将您的根导航控制器的autoresizingMask设置为UIViewAutoresizingNone。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM