设置LaunchImage
设置iOS通用LaunchImage
第一种
点击项目名称,然后点击TARGETS下的项目名,在点击General出现下图内容;

然后点击App Icons and Launch Images 下的Use Asset Catalog...出现如图

直接点击Migrate,然后点击Assets.xcassets,可看到出现了LaunchImage,

然后点击LaunchImage可选择你要放入的LaunchImage,

点击图上右边那个属性,然后选择你要放的设备与是否横竖屏的LaunchImage,这里我就设置如下图选择的LaunchImage,

然后点击项目名,回到如图

看到Launch Images Sourc已经自动帮我们选择了LaunchImage,然后删除Launch Screen File中的内容,如图,然后点击LaunchScreen.storyboard(以前叫LaunchScreen.xib),把Use as Launch Screen勾取消(创建后默认为勾选),如图

然后我们回到Assets.xcassets的Launch Image,拖入如图尺寸的png格式的图片(如图标示都为像素即px),你也可以点击图中放图片的地方,在右边属性也可看到所需图片的像素尺寸。

第二种
先点击项目名,然后点击Assets.xcassets,再点击如下图所示+,然后如图选择,也可创建出LaunchImage,然后步骤同four.png以后的了。


设置iOS8以后的LaunchImage
1.找到Launch Screen.storyboard,点击然后在它上面放个ImageView(距离下左右距离都为0,距离上为-20),设置ImageView的image为自己想要的图片即可。
如果两者都设置了且勾选了Use as Launch Screen就兼容iOS8以前及以后的,但是Launch Screen勾选了这项,系统就会优先选择Launch Screen.storyboard。设置完了将模拟器或真机上的应用卸载了重新跑就看到设置好了,若是不卸载可能有缓存,造成显示不出来。
设置显示时间
在AppDelegate.m文件中写下式可设置启动页显示时间:
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[NSThread sleepForTimeInterval:6.0]; //我这里设置的是6秒
return YES;
}
设置AppIcon
选择项目下的Assets.xcassets然后选择AppIcon,如图

设置AppIcon只需要一张1024*1024的图片,然后安装一个AppIcon生成工具所有尺寸都有了,甩进去就是了,我用的是iConify(免费),可自己在App Store搜,它还支持生成xx.png&xx.@2x.png&xx.@3x.png


把你的图片直接拖到左边框里,点击iConify Folder就生成了想要的图片(无打广告嫌疑)。如图

然后将对应图片甩到项目中AppIcon对应位置就OK了,然后卸载原有项目重新跑一遍就看到AppIcon设置好了。
网友评论