简体   繁体   中英

UIViewController, Auto Layout and iPhone 6

We are updating our Auto Layout-using app to natively support iPhone 6 resolution. We added the iPhone 6 launch image, and most of the views scaled nicely.

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. The view only gets the iPhone 6 resolution when you hit viewWillAppear .

Why is this? Is there anything we can configure or modify to make the views have the final resolution on viewDidLoad already?

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.

截图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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