设置iOS应用启动图

1.设置启动图的作用

在没设置应用启动图的情况下,应用启动时的前一两秒会显示白屏,影响用户体验

2.设置启动图的步骤

1.点击Assets.xcassets进入图片管理,然后在Assets.xcassets左侧的列表栏中进行鼠标右击后,会显示右键菜单列表,在列表中选择New iOS Launch Image选项


设置iOS应用启动图_第1张图片
image

2.选中新生成的LaunchImage文件,在右边的属性栏中可以设置需要支持的iOS版本及Portrait模式(竖屏)及Landscape模式(横屏)下显示的图片


设置iOS应用启动图_第2张图片
image

3.将对应尺寸的启动图片拖到对应的框框内


设置iOS应用启动图_第3张图片
image
  1. iPhone X Portrait iOS 11+
    (3x:1125 x 2436 pixels)
  1. iPhone Portrait iOS8+
    (Retina HD 5.5”:1242 × 2208 pixels, Retina HD 4.7”:750 × 1334 pixels)
  1. iPhone Portrait iOS7+
    (2x:640 × 960 pixels, Retina 4:640 × 1136 pixels)
  1. iPhone Portrait iOS5,6
    (1x:320 × 480 pixels, 2x:640 × 960 pixels, Retina 4:640 × 1136 pixels)
设置iOS应用启动图_第4张图片
image

3.取消系统默认设置使用的LaunchScreen
选择LaunchScreen.storyboard文件,查看右侧菜单栏中的Use as Launch Screen选项是否已选中,如果有选中则需要取消选中


设置iOS应用启动图_第5张图片
image

4.设置Launch Images Source 清空Launch Screen File


设置iOS应用启动图_第6张图片
image

设置iOS应用启动图_第7张图片
image

设置iOS应用启动图_第8张图片
image

配置好以上步骤之后,就可以使用Assets.xcassets里面LaunchImage文件夹中的图片了

经过上述步骤之后,如果仍然无法显示LaunchImage,这时你可以尝试一下以下步骤:

1.菜单-product-Clean-rebuild,也就是重新build程序.
2.菜单-Xcode-preference-Locations-Derived data-open in Finder,然后删除其中的缓存文件,并重新build程序.

你可能感兴趣的:(设置iOS应用启动图)