简体   繁体   中英

iphone 5 and storyboard setting autoresizing masks

I've got a storyboard-driven application, and I'm trying to modify it to support the iPhone 5.

There is a navigation controller, and then my menuViewController . In viewDidLoad of the menu controller, I have verified that self.view.frame is {{0, 0}, {320, 568}} . The view controller's size is set to "Inferred" in the Simulated Metrics, and the main view has "Autoresize Subviews" checked.

But my subviews are not getting resized! (Note that I can manually resize them in code, that's not a problem, but I would really like this to "work" using mostly IB, since I have a lot of views, and that would be about a million times easier.)

I have a full-screen subview that doesn't get resized. It's mask has basically everything enabled.

I also have subviews that are supposed to float at either the bottom or the top, and the ones that float at the top work, but the ones that are supposed to float at the bottom don't.

What should I be checking here? It's probably something stupid that i'm missing, but I've been scratching my head for an hour, and am getting close to just changing all my frames in code. (Which would be ugly as well as inelegant.)

Thanks!

I found a hint here: How to resize App for Iphone 5?

Essentially one of the answers there suggests editing the xml of the storyboard directly. I went in and looked, and the top level view in my viewController had autoresizesSubviews="NO" I changed it to YES , and that fixed the problem for me.

As stated in my original post, I absolutely know for sure that checkbox was checked in the inspector pane. I have no idea why the xml didn't match the inspector.

Check the springs in the autoresize control for your view (not the view controller) within the metrics pane. Try and make them like in the picture below.

在此处输入图片说明

Notice that you will not be able to set the internal springs for a top-level view object (but that's fine: just ensure the 4 side ticks are all activated).

Hope this helps.

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