ios启动画面设置---launch Images(三步搞定)

最近项目做的差不多了,折腾启动画面之类的东西,发现设置启动画面有点问题,折腾了一个晚上,最后发现是个小问题,在此记录下来,已经在ipad1(ios3.2)和new pad(ios6)上做了测试。

工程是基于cocos2d引擎的,希望在横屏情况下使用,时间关系,不写那么详细,按照本文的操作一定可以达到需要的效果。


参考网上的一段说明:

UILaunchImageFile (String - iPhone OS) specifies the name of the launch image file for the application. If this key is not specified, the system assumes a name of Default.png. This key is typically used by universal applications when different sets of launch images are needed for iPad versus iPhone or iPod touch devices.

If you include this key in your Info.plist file, any launch images you include in your application’s bundle should be based on the string. For example, suppose you want to include portrait and landscape launch images for iPad using the base name MyiPadImage.png. You would include the UILaunchImageFile~ipad key in your Info.plist file and set its value to MyiPadImage.png. You would then include a MyiPadImage-Portrait.png file and a MyiPadImage-Landscape.png file in your bundle to specify the corresponding launch images. 


意思很明显,(1)准备横屏和竖屏的启动画面的文件(如果只有竖屏,则准备竖屏的图片,如果只有横屏,则只需要准备横屏的图片,如果支持横竖屏切换,就准备两张吧,如果只支持横竖屏其中一种,记得在target->Summary->Supported Device Orientations 中选中支持的设备方向),如果你的info.plist没有配置LaunchImge,(2)就将横屏和竖屏的图片命名为Default-Landscape.png和Default-Portrait.png, (3)放到资源目录,添加到工程中,然后你就可以在target->Summary->Launch Images中看到啦,接下里clean工程跑下就没问题了。

如果你想把启动画面的那张图片做别的用处或者不想用Default-Landscape.png和Default-Portrait.png名字,可以配置info.plist(我的xcode是4.2的),修改或者添加Launch Image,然后设置值为XXX.png,添加横屏和竖屏的图片命名为XXX-Landscape.png和XXX-Portrait.png,添加到资源目录和工程,就可以啦。


有问题可以QQ联系我(609845230,注明csdn)

下面截图是我使用默认的名称而且只显示横屏启动画面的设置:




你可能感兴趣的:(ios)