问题
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.
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.
回答1:
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).
来源:https://stackoverflow.com/questions/41598165/xcode-8-vary-for-traits-changing-layout-for-all-size-classes