How do I create launch images for iPhone 6 / 6 Plu

2019-01-02 22:21发布

I've got an existing landscape only app that I'm trying to add iPhone 6 / iPhone 6 Plus support for. When I was supporting iOS 6 / 7 I simply used the default-named launch portrait images with a landscape image rotated into portrait (ie. for 4" screens I created a landscape 1136x640 and then rotated to create a 640×1136 launch image.)

I'm trying to get something working for iOS 8 and iPhone 6 / 6+ and have not come up with something that works yet. Here are some things that I have tried:

  1. Follow the pattern for 4" screen launch image convention. I created Default-667h@2x.png and Default-736h@3x.png images. This did trick the simulator to run at proper iPhone 6/6+ resolution but when launching, the 4" screen launch image is used, not the new ones I created.
  2. Use an Asset Catalog - I create portrait launch images for iPhone 6 and iPhone 6 Plus in a LaunchImages Asset, as well as a Landscape one for iPhone 6 Plus. The iPhone 6 Plus works, but iPhone 6 just shows a black screen. (There's no way to create a iPhone 6 landscape launch image in an asset catalog)
  3. Specify UILaunchImages array in Info.plist with entries for all screen sizes (see reference https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW28). I get similar results to an Asset Catalog here. I can get iPhone 6 Plus landscape working but not iPhone 6 landscape.

11条回答
该账号已被封号
2楼-- · 2019-01-02 22:44

The following steps worked for me:

  1. Add the images to the project (root directory or Resources folder) with the following nomination (I will describe them into the Portrait launchimages): Default.png (3.5 inch), Default-568h@2x.png (4 inch), Default-667h@2x.png (iPhone 6), Default-736@3x.png (iPhone 6plus).
  2. Go to the target settings, App Icons And Launch Images on the General tab -> Set the Launch Image Source to not use asset catalog ('Do not use asset catalogs').
  3. Remove the LaunchImage asset from your main image asset
  4. Go to the target settings, App Icons And Launch Images on the General tab -> Set the Launch Image Source to use asset catalog
  5. The XCode 6 is going to ask you about image asset migration from the existing images. Just click to 'Migrate'.

And it worked for me for each kind of devices on iOS7, iOS8. Note: If you check the new LaunchImage asset, then you can see it is really strange. It seems to contain only a few image without the images with iPhone6 or iPhone 6plus resolution.

查看更多
成全新的幸福
3楼-- · 2019-01-02 22:45

To start your application in landscape mode, edit your Info.plist file to add the UIInterfaceOrientation key with the appropriate value (UIInterfaceOrientationLandscapeRight or UIInterfaceOrientationLandscapeLeft), as bellow code. This provides a hint to the system to set the orientation of the status bar appropriately at launch time.

Listing 1: Starting your application in landscape mode

<key>UIInterfaceOrientation</key>
<string>UIInterfaceOrientationLandscapeRight</string> 

for more info click here

查看更多
迷人小祖宗
4楼-- · 2019-01-02 22:46

This is a follow-up to @AlexArgo's answer that extends it so that landscape-only, iOS 9-supporting apps show appropriate launch images on iOS 9 iPhones. As with that answer, no asset catalog, storyboard, or xib is required.

Without these additions, the behavior we saw was that launching our landscape-only app on an iOS 9 iPhone displayed the same image as for iOS 8, but the image was rotated 90-degrees clockwise and distorted by being stretched to the opposite-orientation's dimensions.

Pre-fix iOS 9 iPhone launch screen: Pre-Fix iOS 9 iPhone Launch Screen

There are 2 parts to this solution:

  1. Add the below iOS 9 items to your Info.plist's UILaunchImages array before the iOS 8 items from @AlexArgo's answer.
  2. Add the new launch images referenced in the below iOS 9 items (eg. Default-iOS9-568h) to your app. The new launch images are actual "landscape"-orientation images (wider than they are tall), unlike the images referenced by @AlexArgo's iOS 8 items that started as landscape images but were then rotated to the portrait orientation before being added to the app. Note that both sets of images must remain in the app for this solution to work on iOS 8 and 9 simultaneously.

    <key>UILaunchImages</key>
    <array>
        <dict>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>9.0</string>
            <key>UILaunchImageName</key>
            <string>Default-iOS9</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
            <key>UILaunchImageSize</key>
            <string>{320, 480}</string>
        </dict>
        <dict>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>9.0</string>
            <key>UILaunchImageName</key>
            <string>Default-iOS9-568h</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
            <key>UILaunchImageSize</key>
            <string>{320, 568}</string>
        </dict>
        <dict>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>9.0</string>
            <key>UILaunchImageName</key>
            <string>Default-iOS9-667h</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
            <key>UILaunchImageSize</key>
            <string>{375, 667}</string>
        </dict>
        ...(pre-iOS 9 items)...
    </array>
    

Post-fix iOS 9 iPhone launch screen: enter image description here

查看更多
forever°为你锁心
5楼-- · 2019-01-02 22:49

To work with ipad (landscape and portrait mode), you need to add the UILaunchImages~ipad key in your info.plist :

<key>UILaunchImages~ipad</key>
    <array>
        <dict>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>7.0</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
            <key>UILaunchImageSize</key>
            <string>{768, 1024}</string>
        </dict>
        <dict>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>7.0</string>
            <key>UILaunchImageName</key>
            <string>Default-Portrait</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
            <key>UILaunchImageSize</key>
            <string>{768, 1024}</string>
        </dict>
        <dict>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>7.0</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
            <key>UILaunchImageSize</key>
            <string>{748, 1024}</string>
        </dict>
        <dict>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>7.0</string>
            <key>UILaunchImageName</key>
            <string>Default-Portrait</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
            <key>UILaunchImageSize</key>
            <string>{768, 1004}</string>
        </dict>
    </array>
查看更多
时光不老,我们不散
6楼-- · 2019-01-02 22:52

you just add iPhone6-Portrait@2x.png, then it will fix itself for Landscape as well. I've also a landscape-only app for iPhone 6 and iPhone 6 Plus and it works without problems!

查看更多
手持菜刀,她持情操
7楼-- · 2019-01-02 22:58

If you are using only Images.xassets "Launch Screen File" should be empty. It helped me.

"Launch screen file" is empty

查看更多
登录 后发表回答