美文网首页
设置能够适应各尺寸屏幕的全屏图

设置能够适应各尺寸屏幕的全屏图

作者: CocoaJason | 来源:发表于2020-04-23 22:50 被阅读0次

    有时候会遇到设置launchScreen.storyBoard的图片或者是启动时不同尺寸的活动题、引导图等,可能会根据不同的尺寸来写比较多的判断代码。
    如下,参照launchImage的设置方式,可以减少很多判断的代码。直接按照全屏imageview设置单张图片的方式赋值即可。

    WX20200423-224943@2x.png

    参照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
      }
    }
    

    然后拖入对应尺寸的图片即可

    相关文章

      网友评论

          本文标题:设置能够适应各尺寸屏幕的全屏图

          本文链接:https://www.haomeiwen.com/subject/gdctwhtx.html