有时候会遇到设置launchScreen.storyBoard的图片或者是启动时不同尺寸的活动题、引导图等,可能会根据不同的尺寸来写比较多的判断代码。
如下,参照launchImage的设置方式,可以减少很多判断的代码。直接按照全屏imageview设置单张图片的方式赋值即可。
参照launchImage的content.json文件,设置某imageset的content.json文件如下
{
"images": [
{
"idiom": "iphone",
"scale": "1x"
},
{
"idiom": "iphone",
"scale": "2x"
},
{
"idiom": "iphone",
"scale": "3x"
},
{
"idiom": "iphone",
"scale": "2x",
"subtype": "retina4"
},
{
"idiom": "iphone",
"scale": "3x",
"subtype": "736h"
},
{
"idiom": "iphone",
"scale": "2x",
"subtype": "667h"
},
{
"idiom": "iphone",
"scale": "3x",
"subtype": "2436h"
},
{
"idiom": "iphone",
"scale": "3x",
"subtype": "2688h"
},
{
"idiom": "iphone",
"scale": "2x",
"subtype": "1792h"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
然后拖入对应尺寸的图片即可
网友评论