在XCode 8方向上因性状而异 [英] Vary for Traits in XCode 8 orientation
问题描述
我很困惑为特质而变化"是否是为Portrait& amp;定义不同的布局约束集的正确选择. iPhone上的横向模式.我的目标是为Portrait& iPhone上的横向模式(在iPad上无关紧要).我尝试了为特质而变化",并为Portrait&定义了不同的NSLayoutConstraints集横向模式,但似乎无法正常工作.基本上,如果我有约束P1& P2在人像模式下有效,而C1&对于相同视图的横向模式,C2应该可以完成这项工作. 为特质而变化"真的是为了这份工作吗?
I am confused if 'Vary for Traits' is the right thing to define different set of layout constraints for Portrait & Landscape mode on iPhone. My objective is to have different layouts for Portrait & Landscape modes on the iPhone (doesn't matter on iPad). I tried 'Vary for Traits' and define different set of NSLayoutConstraints for Portrait & Landscape modes but it seems to be not working. Basically if I have constraints P1 & P2 active for portrait mode and C1 & C2 for landscape mode for the same view, that should do the job. Is 'Vary for Traits' really meant for this job?
我该如何撤消使用为特质而变"可能已经添加的所有变体?
Also how do I undo any variations I might have already added using 'Vary for Traits'?
推荐答案
您需要执行以下操作-
- 在纵向模式下设置约束.
- 选择横向模式.
- 禁用在纵向模式下设置的约束.
- 为景观分配新的约束.
- 以纵向"模式返回并禁用在横向"模式中设置的约束.
就是这样.
希望它能起作用.
如有任何疑问,请随时发表评论.
Feel free to comment if you have any confusion..
这篇关于在XCode 8方向上因性状而异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!