简体   繁体   English

UIViewController,自动版式和iPhone 6

[英]UIViewController, Auto Layout and iPhone 6

We are updating our Auto Layout-using app to natively support iPhone 6 resolution. 我们正在更新使用自动布局的应用程序,以原生支持iPhone 6分辨率。 We added the iPhone 6 launch image, and most of the views scaled nicely. 我们添加了iPhone 6启动图像,并且大多数视图都可以很好地缩放。

However, we are experiencing a small annoyance: when loading new view controllers, the views have the iPhone 5 resolution on the UIViewController 's viewDidLoad method. 但是,我们遇到了一个小麻烦:加载新的视图控制器时,视图在UIViewControllerviewDidLoad方法上具有iPhone 5分辨率。 The view only gets the iPhone 6 resolution when you hit viewWillAppear . 当您点击viewWillAppear时,视图仅获得iPhone 6分辨率。

Why is this? 为什么是这样? Is there anything we can configure or modify to make the views have the final resolution on viewDidLoad already? 我们有什么可以配置或修改的,以使视图在viewDidLoad上具有最终分辨率?

I think the right place to get geometry data from your views is in the method: 我认为从您的视图获取几何数据的正确位置是在方法中:

- (void)viewDidLayoutSubviews;

This is called when auto layout finishes laying the views. 自动布局完成放置视图时将调用此方法。 Please beware this method can be called multiple times, ie after a rotation of the device. 请注意,该方法可以多次调用,即在设备旋转之后。

EDIT 编辑

In interface builder, there is an option to set the size for the simulated metrics. 在界面构建器中,有一个选项可以设置模拟量度的大小。 I'm not sure if this has to do only with what interface builder displays, or also with the frame of the view at load time. 我不确定这是否仅与界面构建器显示的内容有关,还是与加载时视图的框架有关。 Maybe you can change it and give it a try. 也许您可以更改它并尝试一下。

截图

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

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