Launch Image does not show up in my iOS App

前端 未结 28 1565
逝去的感伤
逝去的感伤 2020-12-02 04:11

I want to get a simple launch screen to show in my app, built using Xcode 6.0.1.

I have added a launch screen in two ways: As an XIB (with the default name, LaunchSc

相关标签:
28条回答
  • 2020-12-02 04:38

    My solution was to create all the launch images. enter image description here

    Then I set the Launch Images Source to the LaunchImage asset, and leave launch screen file blank.

    Finally if the project does not have a Launch Screen.xib, then add that file and leave it as is. enter image description here

    0 讨论(0)
  • 2020-12-02 04:39

    The LaunchScreen.xib and the info value Launch screen interface file base name are from my experience both placeholders that are created when the project is created. If you would like to use the Images.xcassets exclusively for your launch screens, delete both the LaunchScreen.xib and the info.plist item.

    If you provide the info.plist setting you app will use the xib and not your Images.xcassets

    0 讨论(0)
  • 2020-12-02 04:41

    Do what Spectravideo328 answered and:

    Try to UNCHECK the iOS 7 and later box and CHECK the iOS 6 and prior box in the asset catalog. There seems to be a bug with the iOS 7 Launch Image. (These both have the same Launch Images except for the 320x480 one)

    Hope this helps, it did help for me!

    0 讨论(0)
  • 2020-12-02 04:42

    * (Xcode 7.2 / Deployment Target 7.0 / Landscape Orientation Only) *

    I know is an old question but with Xcode 7.2 I'm still getting the message and I fixed with this:

    1) Select PORTRAIT and both landscapes. Add "Launch Images Source" and "Launch Screen File"

    2) In your Launch Image select iPhone "8.0 and Later" and "7.0 and Later".

    3) Add this code in your appDelegate:

    #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
    - (NSUInteger)supportedInterfaceOrientations
    {
        return UIInterfaceOrientationMaskLandscape;
    }
    #else
    - (UIInterfaceOrientationMask)application:(UIApplication *)application     supportedInterfaceOrientationsForWindow:(UIWindow *)window
    {
        return (UIInterfaceOrientationMaskLandscape);
    }
    #endif
    

    4) Add this on your ViewController

    #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
    - (NSUInteger)supportedInterfaceOrientations
    #else
    - (UIInterfaceOrientationMask)supportedInterfaceOrientations
    #endif
    {
         return UIInterfaceOrientationMaskLandscape;
    }
    

    I hope help to somebody else.

    0 讨论(0)
  • 2020-12-02 04:43

    The problem with the accepted answer is that if you don't set the Launch Screen File, your application will be in upscaling mode on devices such as the iPhone 6 & 6+ => blurry rendering.

    Below is what I did to have a complete working solution (I'm targeting iOS 7.1 & using Xcode 8) on every device (truly, I was getting crazy about this upscaling problem)

    1. Prepare your .xcassets

    To simplify it, I'm using a vector .PDF file. It is very convenient and avoid creating multiple images for each resolution (1x, 2x, 3x...). I also assume here you already created your xcassets.

    • Add your launch screen image (or vector file) to your project
    • Go to your .xcassets and create a New Image Set. In the Attributes window of the Image, select Scales -> Single Scale
    • Drag and drop the vector file in the Image Set.

    2. Create your Launch Screen file

    3. Add your image to your Launch Screen file

    • Add an Image View object to your Launch Screen file (delete the labels that were automatically created). This image view should refer to the previous .xcassets Image Set. You can refer it from the Name attribute. At this stage, you should correctly see your launch screen image in your image view.
    • Add constraints to this image view to keep aspect ratio depending on the screen resolution.

    4. Add your Launch Screen file to your target

    Fianlly, in your Target General properties, refer the Launch Screen file.

    Start your app, and your splash screen should be displayed. Try also on iPhone6 & iPhone6+, and your application should be correctly displayed without any upscaling (the Launch Screen file aims to do this).

    0 讨论(0)
  • 2020-12-02 04:43

    I had the same issue after I started using Xcode 6.1 and changed my launcher images. I had all images in an Asset Catalog. I would get only a black screen instead of the expected static image. After trying so many things, I realised the problem was that the Asset Catalog had the Project 'Target Membership' ticked-off in its FileInspector view. Ticking it to ON did the magic and the image started to appear on App launch.

    0 讨论(0)
提交回复
热议问题