Xcode 8:因特征而异,因此更改所有尺寸类的布局 [英] Xcode 8: Vary for traits changing layout for all size classes

查看:91
本文介绍了Xcode 8:因特征而异,因此更改所有尺寸类的布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用xcode 8.2.1上的very for traits功能,但是当我使用"variant for traits"更改一个大小类的布局,然后在完成后完成更改"时,实际上是在更改布局故事板中每个尺寸的班级.

I am trying to use the very for traits feature on xcode 8.2.1 but when I change the layout of one size class using the 'vary for traits' and then 'done varying' when finished it is in fact changing the layout of every size class in my storyboard.

例如我尝试通过为特征选择"variant"来更改ipad w:R,h:R上的约束,并将底部的条变为蓝色.我进行必要的更改,然后单击完成更改",这将更改约束.但是,如果我选择其他设备尺寸(例如iphone 7),则调整后的约束也将应用于此尺寸类别.如何阻止这种情况发生?

e.g. I try to change the constraints on an ipad w: R, h: R by selecting vary for traits, turning the bar blue at the bottom. I make the necessary changes and click 'done varying' which changes the constraints. But then if I choose another device size such as iphone 7 then the adjusted constraints are also applied to this size class. How do I stop this from happening?

为澄清起见,我有使用特征变化"&在情节提要中选择使用自动版式".

To clarify I have 'Use trait variations' & 'Use Autolayout' selected in the storyboard.

推荐答案

当您开始改变特征时,您添加的 new UI元素只会添加到当前特征集合中(w:R, h:R).但是,如果您要更改现有元素,则它们将针对所有变体而更改,除非您专门添加自定义配置(请参见屏幕截图).

When you start varying for traits, the new UI elements you add are only added to the current trait collection (w: R, h:R in your case). But if you're changing existing elements, they will change for all variations, unless you specifically add a custom configuration (see screenshots).

这篇关于Xcode 8:因特征而异,因此更改所有尺寸类的布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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