设置iOS应用启动图
2018-03-29 本文已影响84人
happycolt
1.设置启动图的作用
在没设置应用启动图的情况下,应用启动时的前一两秒会显示白屏,影响用户体验
2.设置启动图的步骤
1.点击Assets.xcassets进入图片管理,然后在Assets.xcassets左侧的列表栏中进行鼠标右击后,会显示右键菜单列表,在列表中选择New iOS Launch Image选项

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

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

- iPhone X Portrait iOS 11+
(3x:1125 x 2436 pixels)
- iPhone Portrait iOS8+
(Retina HD 5.5”:1242 × 2208 pixels, Retina HD 4.7”:750 × 1334 pixels)
- iPhone Portrait iOS7+
(2x:640 × 960 pixels, Retina 4:640 × 1136 pixels)
- iPhone Portrait iOS5,6
(1x:320 × 480 pixels, 2x:640 × 960 pixels, Retina 4:640 × 1136 pixels)

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

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



配置好以上步骤之后,就可以使用Assets.xcassets里面LaunchImage文件夹中的图片了
经过上述步骤之后,如果仍然无法显示LaunchImage,这时你可以尝试一下以下步骤:
1.菜单-product-Clean-rebuild,也就是重新build程序.
2.菜单-Xcode-preference-Locations-Derived data-open in Finder,然后删除其中的缓存文件,并重新build程序.