尺寸分类的作用
在storyBoard里面使用尺寸分类可以针对多款设备在横屏和竖屏情况下设置不同的布局。如下图:



看到button的位置不同了吧?!!
下面说说设置尺寸分类时要注意的问题
在XCode8中打开stroyBoard,下图是xcode8的和xcode7中的不同已经圈出来了

下面的就是xcode8和xcode7中的不同之处,在xcode7中下面这默认的是w:any h:any意思就是不管在任何设置上都是这种布局。左边的那些圈先不用管。
下面再说说关于宽高设置的约束条件有四种情况:
1.宽度(c)高度(c)除了iphone plus系列外所有横屏phone
2.宽度(c)高度(r)所有竖屏的iphone
3.宽度(r)高度(c)横屏的iphone plus
4.宽度(r)高度(r)横屏和竖屏时所有的ipad
c意思是紧凑,r的意思是标准
接着说上图总左边那些圈圈的意思,大家可以看到左侧圈出的那些约束的颜色是灰色的,意思是在当前的模式下这些约束不可用,那些不可用的约束是在竖屏情况下的约束,而那些可用的约束(除了灰色外那些蓝色的约束)就是在横屏下才有效的约束。let's do it!
直接上图片
//2016年11月3日更新图片不显示




如果有不对的地方请大家在评论区指出。
网友评论