xcode iPhone 和 iPad 应用程序启动图像
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6573602/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iPhone & iPad Apps Launch Images
提问by Richard Stelling
Preamble:This is intended to be be a canonical question (and answer) on iOS Apps launch images (aka Default.png).
序言:这旨在成为 iOS 应用程序启动图像(又名 Default.png)上的规范问题(和答案)。
Questions
问题
- What is the best way to set the
Default.png
; Manually in the Info.plist or using Xcode (supported in xcode-4only, I think) - Does the iPhone auto-rotate the
Default.png
depending on the device orientation?- What effect does the
UIInterfaceOrientation
(Initial interface orientation) key in the Info.plist have? - Does
UISupportedInterfaceOrientations
andUISupportedInterfaceOrientations~ipad
have any effect on displaying the Default.png
- What effect does the
- Can I set different Default.png for the iPad using these file names?:
- Default-Portrait.png
- Default-PortraitUpsideDown.png
- Default-Landscape.png
- Default-LandscapeLeft.png
- Default-LandscapeRight.png
- Are there iPhone equivalents (see 3)
- Is there any Appledocumentation that covers all aspects of "Launch Images"? If so, where?
- 设置
Default.png
;的最佳方法是什么?在 Info.plist 中手动或使用 Xcode(我认为仅在xcode-4 中支持) - iPhone 是否会
Default.png
根据设备方向自动旋转?UIInterfaceOrientation
Info.plist中的(Initial interfaceorientation)键有什么作用?- 是否
UISupportedInterfaceOrientations
与UISupportedInterfaceOrientations~ipad
有上显示为Default.png任何影响
- 我可以使用这些文件名为 iPad 设置不同的 Default.png 吗?:
- 默认-Portrait.png
- 默认-PortraitUpsideDown.png
- 默认-Landscape.png
- 默认-LandscapeLeft.png
- 默认-LandscapeRight.png
- 是否有 iPhone 等价物(见 3)
- 是否有任何涵盖“启动图像”所有方面的Apple文档?如果有,在哪里?
NB:It seems the usage of launch images changes quite frequently between SDK releases, please indicate in your answers what version you are talking about
注意:似乎在 SDK 版本之间启动图像的使用变化非常频繁,请在您的回答中指出您所谈论的版本
回答by bitfox
5) Is there any Apple documentation that covers all aspects of "Launch Images"? If so, where?
5) 是否有任何涵盖“启动图像”所有方面的 Apple 文档?如果有,在哪里?
There's something here:
有什么东西在这里:
Supply a launch image to improve user experience.
Avoid using it as an opportunity to provide:
- An “application entry experience,” such as a splash screen
- An About window
- Branding elements, unless they are a static part of your application's first screen
提供启动图像以改善用户体验。
避免将其用作提供以下内容的机会:
- “应用程序入口体验”,例如启动画面
- 关于窗口
- 品牌元素,除非它们是应用程序第一个屏幕的静态部分
回答by Rog
Partial answers based on latest iPhone iOS
基于最新 iPhone iOS 的部分答案
- Manually in the Info.plist or using Xcode (supported in xcode-4 only, I think)
- 在 Info.plist 中手动或使用 Xcode(我认为仅在 xcode-4 中支持)
These two methods are equivalent. Xcode merely presents a convenience editor UI for the info.plist. There is no other way to specify the launch image (available to 3rd party developers) than setting it in info.plist.
这两种方法是等价的。Xcode 只是为 info.plist 提供了一个方便的编辑器 UI。除了在 info.plist 中设置它之外,没有其他方法可以指定启动图像(可供 3rd 方开发人员使用)。
- Does the iPhone auto-rotate the Default.png depending on the device orientation?
- iPhone 是否会根据设备方向自动旋转 Default.png?
No. but as Springoard does not support upside down, it is unlikely that any portrait apps are launched upside down.
不会。但由于 Springoard 不支持倒置,因此任何纵向应用程序不太可能倒置启动。
What effect does the UIInterfaceOrientation (Initial interface orientation) key in the Info.plist have?
Info.plist中的UIInterfaceOrientation(初始界面方向)键有什么作用?
None
没有任何
Does UISupportedInterfaceOrientations and UISupportedInterfaceOrientations~ipad have any effect on displaying the Default.png
UISupportedInterfaceOrientations 和 UISupportedInterfaceOrientations~ipad 对显示 Default.png 有什么影响吗
No.
不。
回答by Basil Bourque
In my experience, the simplest approach with the easiest maintenance is to simply follow Apple's conventionswhen naming your launch image files. If you carefullyread and follow those naming conventions, everything else becomes automatic. Automated features include:
根据我的经验,最简单维护最简单的方法是在命名启动图像文件时遵循Apple 的约定。如果您仔细阅读并遵循这些命名约定,其他一切都会变得自动。自动化功能包括:
- Choosing different launch image files for different device screens.
- Handling the new taller screen found on current iPhone 5/5S & iPod touch.
- Handling Retina screens.
- Handling device orientation (Portrait vs Landscape) on iPad. (handhelds have only Portrait)
- Displaying thumbnails in Xcode 4
- 为不同的设备屏幕选择不同的启动图像文件。
- 处理当前 iPhone 5/5S 和 iPod touch 上新的更高屏幕。
- 处理 Retina 屏幕。
- 在 iPad 上处理设备方向(纵向与横向)。(掌机只有人像)
- 在 Xcode 4 中显示缩略图
If you:
如果你:
- Create image files with the correct resolution (carefully read the doc, as resolutions are not what you might expect)
- Follow the naming rules documented by Apple
- Place the files at the top level of your app bundle?
- 创建具有正确分辨率的图像文件(请仔细阅读文档,因为分辨率不是您所期望的)
- 遵循Apple 记录的命名规则
- 将文件放在应用程序包的顶层?
…then:
…然后:
- Thumbnails of the images will automatically appear within project settings of Xcode 4.
- Your launch images will automatically be used on devices as well as the iOS Simulator.
- 图像的缩略图将自动出现在 Xcode 4 的项目设置中。
- 您的启动图像将自动用于设备和iOS 模拟器。
By following the naming conventions, you need not:
通过遵循命名约定,你需要不是:
- Select images manually in the Xcode project settings
- Edit any info-plist
- 在 Xcode 项目设置中手动选择图像
- 编辑任何信息列表
The naming conventions work at least in iOS 5, 6, and 7. I believe they also work in earlier versions as well.
命名约定至少适用于 iOS 5、6 和 7。我相信它们也适用于早期版本。
?Image files should notbe nested in any physical folder. After adding them to Xcode, you may group them into a virtual folder within Xcode's project listing to avoid visual clutter.
?图像文件应该不被嵌套在任何物理文件夹。将它们添加到 Xcode 后,您可以将它们分组到 Xcode 项目列表中的一个虚拟文件夹中,以避免视觉混乱。
Tip: To verify which image is being used, alter the image itself to display the file name as part of the image. Make a backup of your images first, of course.
提示:要验证正在使用哪个图像,请更改图像本身以将文件名显示为图像的一部分。当然,首先备份您的图像。