如何在界面生成器中对视图设置约束以满足Xcode 8中的所有iphone屏幕 [英] how to put constraints on views in interface builder to satisfy all iphone Screen in Xcode 8

查看:149
本文介绍了如何在界面生成器中对视图设置约束以满足Xcode 8中的所有iphone屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试以下方法,如钉扎,纵横比,垂直间距,水平/垂直间距,前/后空间;但它并不适用于iPhone及以上版本的所有iPhone屏幕。

I have been trying the following such as pinning, aspect ratio, vertical spacing ,horizontal/vertical spacing,leading/trailing space; but it is not working uniformly for all iPhone screen from iPhone se and above.

推荐答案

您不再对每个设备应用约束。您应用每个大小类的自动布局约束。

You dont apply constraints for each device anymore. You apply auto layout constraints per size class.

如果您知道每个iOS设备都属于每个方向的尺寸等级之一。如果您不了解大小等级,请阅读相关内容。

If you are aware each and every iOS devices falls under one of the size class in each orientation. If you aren't aware of size class do read about it.

至于回答您的问题,
1.您将添加所有约束大小类到任何x任何。

As to answer your question, 1. You will add constraints which are common across all the size classes to any x any.

2.你总是可以添加特定于大小类的约束(我的意思是你可以添加一个大小类的约束,而如果你不想要它在其他大小类中卸载它)

2.you can always add constraints specific to size class (What I mean is you can add constraints one size class while uninstall it in other size class if you dont want it)

3.您可以选择任何约束并提供常量值,特定于size class的乘数(例如:您可以在CxC中将高度约束常量设置为50)虽然您可以在(R x R)中将其设置为150而不添加新约束。

3.you can select any of the constraint and provide it constant values, multipliers specific to size class (e.g.: you can set the height constraint constant to 50 in CxC while you can set it to 150 in (R x R) without adding a new constraint.

这篇关于如何在界面生成器中对视图设置约束以满足Xcode 8中的所有iphone屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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