iOS版的自动布局可以重新排列UI组件 [英] Can iOS's auto layout rearrange UI widgets

查看:327
本文介绍了iOS版的自动布局可以重新排列UI组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有具有纵向和横向不同的UI应用程序。我听说过自动布局美妙的事情,但在我所有读数似乎处理简单的情况下,在UI组件调整和重新定位简单。在我的UI UI部件移动。这是我应该尝试,并得到汽车布局工作,或者我应该只是做2 xibs,并用它做一个案例?

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.

推荐答案

对不起,一是自动布局设置不会允许你重新安排意见这样。你仍然可以使用自动布局位置和间隔,但你需要两套设置。

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.

您仍然可以使用一个XIB文件并在运行时更改自动布局设置,但最有可能多xibs更有意义,因为你可以看到和编辑UI所见即所得的风格。

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.

更新

此外,看一看的iOS 9的新的<一个href=\"https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIStackView_Class_Reference/\"相对=nofollow> UIStackView

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

这篇关于iOS版的自动布局可以重新排列UI组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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