简体   繁体   English

iOS:自动版式将视图从左至右移动

[英]iOS: autolayout move view from left to top right

I have 3 views and I wish to handle their layouts using autolayout constraints. 我有3个视图,我希望使用自动布局约束来处理其布局。 Portrait is like this: 人像是这样的:

在此处输入图片说明

and landscape should be as follows: 景观应如下:

在此处输入图片说明

How do I do this using autolayout? 如何使用自动版式执行此操作? I tried adding constraints, but the 3rd view(in green color), doesn't move up. 我尝试添加约束,但是第三视图(绿色)没有向上移动。 It moves on the right side though. 它虽然在右侧移动。

Where am I getting wrong? 我哪里出问题了? How do I solve it? 我该如何解决?

It can be easily done using Size Classes , take a look at apple doc Size Classes design help 使用Size Classs可以很容易地做到这一点,看看Apple Doc Size Classes设计帮助

This feature available only in xCode 6 New Features in xCode 6 . 仅在Xcode 6个此功能的新功能在Xcode 6

w ** Any ** h ** Any **布局中的约束

w ** Any ** h ** Compact **布局中的约束

Keep the same Constraints for other layouts. 对于其他布局,请保持相同的约束。

Note that Gray coloured constraints are not installed for present layout. 请注意,当前布局未安装灰色约束。

You can find the sample in the link DownLoad Sample 您可以在下载样本链接中找到样本

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

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