iOS开发中设置App启动图有两种设置方式,分别为Launch Images Source 和 Launch Screen File,新建项目时Xcode会自动创建LaunchScreen.storyboard且默认使用Launch Screen File的方式展示启动图。
首先我们创建一个新工程

其次,填写项目相关信息

选择完毕后进入工程

依次选择


选择完毕之后点击如下图

依照图中方法新创建LaunchImage

创建完成后

刚创建完成后进入时如图

根据下图选择,图片格式及尺寸一定不能错

如果图片格式或者图片尺寸选择错误就会出现下图问题
启动图变成了拉伸的app图标

iOS启动图尺寸
尺寸说明
iPhone Portrait iOS 8,9-Retina HD 5.5 (1242×2208) @3x
iPhone Portrait iOS 8,9-Retina HD 4.7 (750×1334) @2x
iPhone Portrait iOS 7,9-2x (640×960) @2x
iPhone Portrait iOS 7,9-Retina 4 (640×1136) @2x
iPhone Portrait iOS 5,6-1x (320×480) @1x
iPhone Portrait iOS 5,6-2x (640×960) @2x
iPhone Portrait iOS 5,6-Retina4 (640×1136) @2x
如果想修改启动图的展示时间可参照下面代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[NSThread sleepForTimeInterval:1.0]; // 设置启动页面时间
}
网友评论