简体   繁体   English

iPhone 5和情节提要设置自动调整大小蒙版

[英]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. 我有一个故事板驱动的应用程序,并且我试图对其进行修改以支持iPhone 5。

There is a navigation controller, and then my menuViewController . 有一个导航控制器,然后是我的menuViewController In viewDidLoad of the menu controller, I have verified that self.view.frame is {{0, 0}, {320, 568}} . 在菜单控制器的viewDidLoad中,我已验证self.view.frame为{{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.) (请注意,我可以在代码中手动调整它们的大小,这不是问题,但是我真的希望它主要使用IB来“工作”,因为我有很多视图,这大约容易上百万倍。)

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? 我在这里找到了一个提示: 如何为Iphone 5调整App的大小?

Essentially one of the answers there suggests editing the xml of the storyboard directly. 本质上,答案之一是建议直接编辑情节提要的xml。 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. 我进去看了看, viewController的顶层视图具有autoresizesSubviews="NO" ,将其更改为YES ,这为我解决了问题。

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. 我不知道为什么xml与检查器不匹配。

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). 请注意,您将无法为顶级视图对象设置内部弹簧(但这很好:只需确保4个侧勾都已激活)。

Hope this helps. 希望这可以帮助。

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

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