Xcode 8 中缺少“任何”尺寸类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38257754/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:01:16  来源:igfitidea点击:

"Any" size class missing in Xcode 8

iosxcodeinterface-builder

提问by FlySoFast

I'm a little confused when seeing the new interface builder's size class options in Xcode 8 beta. I used to build my apps' UI by first design them in "Any" size class and then do some custom adjustments in the other ones. Is the workflow supposed to be changed in this new version of Xcode?

在 Xcode 8 beta 中看到新的界面构建器的大小类选项时,我有点困惑。我过去常常通过首先在“任何”尺寸类中设计它们,然后在其他尺寸类中进行一些自定义调整来构建我的应用程序的 UI。这个新版本的 Xcode 是否应该更改工作流程?

Any size class in Xcode 7

Xcode 7 中的任何尺寸类

采纳答案by Zack

The way to do this has changed slightly in the new version of Xcode. It should build for "any-any" automatically. Have a look at this WWDC video that I think explains it in detail. There is also a part 2, so watch that if you need to.

在新版本的 Xcode 中,这样做的方法略有变化。它应该自动为“any-any”构建。看看这个 WWDC 视频,我认为它详细解释了它。还有第 2 部分,所以如果需要,请观看。

https://developer.apple.com/videos/play/wwdc2016/222/

https://developer.apple.com/videos/play/wwdc2016/222/

Hope I could help,
Zack

希望我能帮上忙,
扎克

回答by Durga Vundavalli

The UI to select the size classes has changed in xcode 8. Now it is as follows:

用于选择大小类的 UI 在 xcode 8 中已更改。现在如下所示:

Any constraints that you add without selecting Vary for Traitsoptions will be considered as for all the size classes( Any Anypreviously)

您在没有为 Traits选项选择Vary 的情况下添加的任何约束都将被视为所有大小类(之前的Any Any

enter image description here

在此处输入图片说明

To add a constraint to a specific size class add it by selecting:

要向特定尺寸类添加约束,请选择:

  • The device at the bottom and by selecting Vary for Traitsoptions of that size class.
  • When you are adding constraints to a specific size class the bar turns blue as below
  • 底部的设备并通过 为该尺寸类别的特征选项选择变化
  • 当您向特定尺寸类添加约束时,条形变为蓝色,如下所示

enter image description here

在此处输入图片说明

回答by Starchand

To convert from the old Any by Any to the new Trait layout, go through each of your View Controllers and update all frames.

要将旧的 Any by Any 转换为新的 Trait 布局,请检查每个视图控制器并更新所有帧。

Screen shot

截屏