在界面构建器中设置自动调整问题 [英] Problem setting autosizing in interface builder

查看:123
本文介绍了在界面构建器中设置自动调整问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个viewControllers,一个是UIViewController的子类(正确自动化),另一个是UIViewController的子类的子类。

我在Interface Builder中做了一个布局,我测试了我的代码在模拟器中,一切都按预期工作。但是如果我旋转设备我的视图不会调整大小。

所以我回到Interface Builder并发现我无法更改root-UIView的Resizing属性。所以我打开了另一个文件,resizing属性也在那里修复。但它将在两个方向上调整大小。这就是我想要的行为。

I have two viewControllers, one is a subclass of UIViewController (autoresizes correctly), the other one is a subclass of a subclass of UIViewController.
I did a layout in Interface Builder, I tested my code in the Simulator and everything works as expected. But if I rotate the device my views don't resize.
So I went back to Interface Builder and found out that I cannot change the Resizing property of the "root"-UIView. So I opened another file and the resizing property is fixed there, too. But it is set to resizing in both direction. This is the behavior I want.

如何更改顶级UIView的自动调整以使其达到我想要的效果?

没有太多的子视图无法从头开始,但我不想这样做。

How can I change the autoresizing of the top UIView so it does what I want?
There are not so many subviews that it is impossible to start again from scratch, but I don't want to do this.

推荐答案

我之前遇到过这种情况,令人非常沮丧。事实证明,当您打开模拟用户界面元素时,您无法按照自己的意愿更改支柱和弹簧。

I ran into this before and it was incredibly frustrating. It turns out that when you have Simulated User Interface Elements turned on then you can't change the struts and springs like you want.

转到属性选项卡(Cmd-1)并确保状态栏,顶栏,底栏和拆分视图都设置为未指定。然后返回大小选项卡(Cmd-3),您将能够单击这些行并更改Struts和Springs。然后最后你可以回到Cmd-1并重新打开那些模拟元素。

Go to Attributes tab (Cmd-1) and make sure that Status Bar, Top Bar, Bottom Bar, and Split View are all set to "Unspecified." Then go back to the Size tab (Cmd-3) and you'll be able to click the lines and changes your Struts and Springs. Then finally you can go back to Cmd-1 and turn those simulated elements back on.

这篇关于在界面构建器中设置自动调整问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆