Orienting iOS splash image to landscape/portrait according to launch orientation

蹲街弑〆低调 提交于 2019-11-27 05:38:18

问题


I have an app that can launch in portrait or landscape. I'd like the Default.png file (the splash image that appears when the app launches) to show the image in the correct orientation so I expect I'd need to use two different images (different dimensions). I don't know how to make the app pick which image to use based on its launching orientation, however. Is this possible? Is there any way to know what orientation the app is launching in (before the splash is shown) and then pick the correct image, or do I simply have to settle with either having the image rotated sideways in one of the orientations or having an image that is indistinguishable at 90 degree rotations?


回答1:


You can name your start up images specifically for the orientation and each one will be displayed for that orientation

  1. Default-Portrait.png
  2. Default-PortraitUpsideDown.png
  3. Default-Landscape.png
  4. Default-LandscapeLeft.png
  5. Default-LandscapeRight.png



回答2:


See: http://iosdevelopertips.com/ipad/ipad-managing-multiple-launch-images.html

When loading an application on an iPhone or iPad, a launch image can be shown to provide feedback to the user that the application is loading. On the iPhone one Default.png file was adequate, with the iPad one needs to anticipate the device being started in any orientation, including upside down.

iPad Launch Image Orientations

To deal with various orientation options, a new naming convention has been created for iPad launch images. The screen size of the iPad is 768×1024, notice in the dimensions that follow the height takes into account a 20 pixel status bar.

Filename, Dimensions

Default-Portrait.png * (768w x 1004h)

Default-PortraitUpsideDown.png (768w x 1004h)

Default-Landscape.png ** (1024w x 748h)

Default-LandscapeLeft.png (1024w x 748h)

Default-LandscapeRight.png (1024w x 748h)

Default.png (Not recommended)

  • If you have not specified a Default-PortraitUpsideDown.png file, this file will take precedence.

  • If you have not specified a Default-LandscapeLeft.png or Default-LandscapeRight.png image file, this file will take precedence. Although you can include a Default.png file, and it will be used if no others are specified, I would consider it a best-practice to include all the relevant images needed by your application.

See also apple.com: https://developer.apple.com/library/content/qa/qa1588/_index.html, "Provide Launch Images".

Note:

iPhone-only applications:

iPhone-only applications may only have one launch image.

And: (Apple) Providing Launch Images for Different Orientations, (Apple) Launch Image Type

EDIT 28/06/2014: This answer is from 2011 and as pointed out by @AlexShaffer: "These resolutions listed above are out of date for iOS 7. Launch images for iOS 7 include the status bar area. You should probably also use image catalogs for iOS 7 instead of using images with a naming convention: https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/AddingLaunchImagestoanAssetCatalog/AddingLaunchImagestoanAssetCatalog.html"



来源:https://stackoverflow.com/questions/5781846/orienting-ios-splash-image-to-landscape-portrait-according-to-launch-orientation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!