项目启动页设置其实很简单,分为以下几个步骤:
1.新建工程项目,有一个默认的(Assets.xcassets),的资源文件,然后鼠标右键效果如下,

选中(New IOS Launch Image),即可
2.注意对应的尺寸如下:iPhone X 1125*2436


3.单击工程项目名称,在 (General)选项卡下,(App Icons and Launch Images) 从初始状态如下:

改变为如下状态:

但有时候设置了上面的所有步骤,但启动页面还是不显示出来,原因在于,在项目中有两种设置启动页面的方式,如上只是一种,还有一种就是通过新建工程项目之后,自动生成的一个LaunchScreen.storyboard 文件,将如下图片中(Use as launch Screen) 选项勾去掉即可.

4.如果在实际开发中需要启动页停留一定的时间可以在(AppDelegate.m)-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 方法中设置启动页面的停留时长 [NSThread sleepForTimeInterval:3.0];//设置启动页面时间 这种只是针对 ObjectC 针对 Swift 语言的用法如下:

网友评论