Xcode 4.5 + UIScrollView: Cannot see struts and sp

2019-03-24 12:47发布

Disclaimer: Brand new to iOS dev. Go easy on me.

Got a funny situation in Xcode 4.5. My Size Inspector looks like this:

enter image description here

...and I can't see the struts and springs area at all.

The really strange part is that when I click away to something like the Connections inspector I do see the struts and springs area, but only for a split second, and it is gone when I come back.

Is this normal? Is there an easy way to correct this behavior?

3条回答
2楼-- · 2019-03-24 12:58

In Xcode 4.5, for iOS 6 and OSX 10.8 development, AutoLayout is being enabled by default.

To turn it off, open your xib file and click on a blank spot (not on a view or any component). On the inspector panel, select the first tab and remove the "Use Autolayout" checkbox. Your springs and struts will be back.

enter image description here

查看更多
太酷不给撩
3楼-- · 2019-03-24 13:10

Same answer as the other two, but for projects using storyboards: instead of opening a xib file, you can simply open the storyboard to see the "Use Autolayout" checkbox in the inspector panel.

查看更多
啃猪蹄的小仙女
4楼-- · 2019-03-24 13:19

You have Autolayout enabled for the view, turn that off and it will look like what you expect. Autolayout is a new feature for iOS6 that allows more granular control of how things are laid out, and really enhances what was previously available via the struts and sprints via autoresizing masks.

To turn if off, open the Identify Inspector, and uncheck "Use Autolayout"

enter image description here

查看更多
登录 后发表回答