Can iOS's auto layout rearrange UI widgets

烂漫一生 提交于 2019-12-22 08:59:08

问题


I have an app which has a different UI for portrait and landscape. I've heard wonderful things about Auto Layout but in all my readings it seems to handle simple cases, where UI widgets resize and reposition simply. In my UI UI widgets move. Is this a case where I should try and get auto layout to work or should I just make 2 xibs and be done with it?

You can see in the portrait version that the green element is below the magenta one, but it is above it and next to the orange one in the landscape orientation.


回答1:


Sorry, one auto layout setting will not allow you to rearrange views like that. You could still use auto-layout for positioning and spacing, but you'll need two sets of settings.

You could still use one xib file and change the auto layout settings at run time, but most likely multiple xibs makes more sense because you'll be able to see and edit your UI WYSIWYG style.

Update

Also, take a look at iOS 9's new UIStackView.



来源:https://stackoverflow.com/questions/17432321/can-ioss-auto-layout-rearrange-ui-widgets

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!