zoukankan      html  css  js  c++  java
  • xcode7、iOS9 设置启动图片(Launch Image)

    主要是解决上架的时候遇到的问题,顺便把LaunchImage的使用学习一下,一开始项目使用的xib作为启动页的,最近上架打包的时候报错,通不过,问题如下:

     ERROR ITMS-90096: "Your binary is not optimized for iPhone 5 - New iPhone apps and app updates submitted must support the 4-inch display on iPhone 5 and must include a launch image referenced in the Info.plist under UILaunchImages with a UILaunchImageSize value set to {320, 568}. Launch images must be PNG files and located at the top-level of your bundle, or provided within each .lproj folder if you localize your launch images. Learn more about iPhone 5 support and app launch images by reviewing the 'iOS Human Interface Guidelines' at 'https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html#//apple_ref/doc/uid/TP40006556-CH14-SW5' and the 'iOS App Programming Guide' at 'https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/App-RelatedResources/App-RelatedResources.html#//apple_ref/doc/uid/TP40007072-CH6-SW12'."

    一.添加启动图片 

    • 点击Assets.xcassets进入图片管理,右击,弹出"New Launch Image"或点下面的+号创建Launch Image;
    • 如图,右侧的勾选可以让你选择是否要对ipad,横屏,竖屏,以及低版本的ios系统做支持.这边我选了ios8.0和ios7.0。

     

    LaunchImage添加不同尺寸的图片,在设置中进行设置,如下图:

    二.拖入相应尺寸的图片,以本例子需要为例。

    我试了一下这里的图片名字可以任意命名,不过格式必须为png格式,如果只是写个demo,也可以下载我所用的这套图片http://download.csdn.net/download/riven_wn/9196015

    640*960   (4/4s)                                 2X位置

    640*1136  (5/5s/5c)                      R4位置

    750*1334   (6)                               R4.7位置

    1242*2208  (6 plus)                      R5.5位置

    三.General里面的设置。

    如图,Launch Image Source 要设置为LaunchImage,Launch Screen File的内容删除为空。

    四.要把LaunchScreen.storyboard(低版本Xcode为LaunchScreen.xib)中的用作LaunchScreen的复选框勾选取消掉,如图。

     

    到这里就大功告成了,so easy,不过有时候会出现第一次运行显示不正常的情况,一般把App删除重新run一遍就好了。

     如果觉得显示时间不能满足需求,可以添加此方法延长显示时间(此为Swift版本,oc类似)

    override func viewDidLoad()   
    {  
            super.viewDidLoad()  
            NSThread.sleepForTimeInterval(3.0)//延长3秒  
    }  
    
    (此为oc版本)
    - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
    {
        [NSThread sleepForTimeInterval:2.0]; //设置启动页面时间,系统默认1秒
    }
    

    另外,还有常用的利用LaunchScreen.xib(LaunchScreen.storyboard)加载启动页和广告,可参考:欢迎界面Launch Screen动态加载广告

    补充:之前有人出现,用LaunchScreen.xib真机运行的时候出现黑屏的情况,在网上看到这篇文章说是图片名字的问题,我亲自试了一下,发现用launchScreen.png不定性的出现黑屏,所以也贴在这里供大家参考。

    五、iOS设置LaunchScreen后真机启动画面为黑屏的解决办法

     最近在Xcode7下做一个项目,由于还不适应LaunchScreen.storyboard,就把之前项目的LaunchScreen.xib拖进来当做启动界面。


    首先 在上面放了一个全屏的ImageView,图片为LaunchScreen.png,在真机测试启动界面为黑屏,但是在模拟器确正常。把image设置为空,改变imageView的background color发现有效,说明不是imageView的问题。网上的改变图片解析度、使用Assets.xcassets都不行。
     
    解决办法:把LaunchScreen.png改为LaunchImage.png、Launch.png、LaunchBackgroundImage.png、LaunchBuLaBuLaBu.png…
    改变图片名字,只要不是LaunchScreen.png就可以
     这可能是一个小bug,之前的项目都没问题。遇到的情况很少。
  • 相关阅读:
    【Markdown】Markdown相关问题
    【Eclipse】在Project Explore中隐藏不需要显示的文件
    【Eclipse】编译使用Makefile的C工程
    【C】编译提示 warning: incompatible implicit declaration of built-in function ‘calloc’ [enabled by default]
    【Ubuntu】命令记录
    【Vim】Vim学习
    【Ubuntu】安装配置apahce
    【MPI】执行mpiexec出错
    文件上传(java web)
    使用JavaMail发送邮件
  • 原文地址:https://www.cnblogs.com/yipingios/p/6248882.html
Copyright © 2011-2022 走看看