ios 如何为 iPhone 6 和 6 Plus 上的应用程序启用原生分辨率?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25754942/
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
How to enable native resolution for apps on iPhone 6 and 6 Plus?
提问by villapossu
Xcode 6 GM now includes simulators for iPhone 6 and 6 Plus, and by default they run apps in a scaled mode.
Xcode 6 GM 现在包含适用于 iPhone 6 和 6 Plus 的模拟器,默认情况下它们以缩放模式运行应用程序。
To enable the new screen size I tried adding [email protected]
which seems to do a part of the trick since the app now fails to run at all, with the error "Unable to run app in Simulator – An error was encountered while running (Domain = LaunchServicesError, Code = 0)".
为了启用新的屏幕尺寸,我尝试添加[email protected]
这似乎做了一部分技巧,因为应用程序现在根本无法运行,并出现错误“无法在模拟器中运行应用程序 - 运行时遇到错误(域 = LaunchServicesError,代码 = 0)”。
Has anyone figured out how to get an app actually run in the 6/6+ resolution?
有没有人想出如何让应用程序以 6/6+ 分辨率实际运行?
回答by David L
You can add a launch screen file that appears to work for multiple screen sizes. I just added the MainStoryboard as a launch screen file and that stopped the app from scaling. I think I will need to add a permanent launch screen later, but that got the native resolution up and working quickly. In Xcode, go to your target, general and add the launch screen file there.
您可以添加似乎适用于多种屏幕尺寸的启动屏幕文件。我刚刚添加了 MainStoryboard 作为启动屏幕文件,这阻止了应用程序的缩放。我想我稍后需要添加一个永久启动屏幕,但这使原始分辨率提高并快速运行。在 Xcode 中,转到您的目标、常规并在那里添加启动屏幕文件。
回答by rmaddy
If you are using asset catalogs, go to the LaunchImages asset catalog and add the new launch images for the two new iPhones. You may need to right-click and choose "Add New Launch Image" to see a place to add the new images.
如果您使用资产目录,请转到 LaunchImages 资产目录并为两部新 iPhone 添加新的启动图像。您可能需要右键单击并选择“添加新启动图像”以查看添加新图像的位置。
The iPhone 6 (Retina HD 4.7) requires a portrait launch image of 750 x 1334.
iPhone 6 (Retina HD 4.7) 需要 750 x 1334 的纵向启动图像。
The iPhone 6 Plus (Retina HD 5.5) requires both portrait and landscape images sized as 1242 x 2208 and 2208 x 1242 respectively.
iPhone 6 Plus (Retina HD 5.5) 要求纵向和横向图像的尺寸分别为 1242 x 2208 和 2208 x 1242。
回答by A.Badger
I've made basic black launch screens that will make the app scale properly on the iPhone 6 and iPhone 6+:
我制作了基本的黑色启动屏幕,可以让应用在 iPhone 6 和 iPhone 6+ 上正确缩放:
If you already have a LaunchImage in your .xcassett, open it, switch to the third tab in the right menu in Xcode and tick the iOS 8.0 iPhone images to add them to the existing set. Then drag the images over:
如果您的 .xcassett 中已经有 LaunchImage,请打开它,切换到 Xcode 右侧菜单中的第三个选项卡,然后勾选 iOS 8.0 iPhone 图像以将它们添加到现有集合中。然后把图片拖过去:
回答by William Jockusch
I didn't want to introduce an asset catalog.
我不想引入资产目录。
Per the answer from seahorseseaeo here, adding the following to info.plist worked for me. (I edited it as a "source code".) I then named the images [email protected] and [email protected]
根据 seahorseseaeo此处的回答,将以下内容添加到 info.plist 对我有用。(我将其编辑为“源代码”。)然后我将图像命名为 [email protected] 和 [email protected]
<key>UILaunchImages</key>
<array>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-667h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{375, 667}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-736h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{414, 736}</string>
</dict>
</array>
回答by tomi44g
Note that iPhone 6 will use the 320pt (640px) resolution if you have enabled the 'Display Zoom' in iPhone > Settings > Display & Brightness > View.
请注意,如果您在 iPhone > 设置 > 显示和亮度 > 查看中启用了“显示缩放”,iPhone 6 将使用 320pt (640px) 分辨率。
回答by Umar Farooq
Do the following (see in photo)
执行以下操作(见照片)
- Goto asset catalog
right-click and choose "Add New Launch Image"
- iPhone 6 -> 750 x 1334
- iPhone 6 Plus -> 1242 x 2208 and 2208 x 1242
- 转到资产目录
右键单击并选择“添加新的启动图像”
- iPhone 6 -> 750 x 1334
- iPhone 6 Plus -> 1242 x 2208 和 2208 x 1242
回答by Jeremy Huddleston Sequoia
An error was encountered while running (Domain = LaunchServicesError, Code = 0)
运行时遇到错误(域 = LaunchServicesError,代码 = 0)
Usually this indicates that installd returned an error during the install process (bad resources or similar).
通常这表示 installd 在安装过程中返回了一个错误(坏资源或类似的)。
Unfortunately, Xcode does not display the actual underlying error (feel free to file dupes of this known bug).
不幸的是,Xcode 没有显示实际的底层错误(请随意提交这个已知错误的文件)。
You should check ~/Library/Logs/CoreSimulator/CoreSimulator.logwhich will log the underlying error for you.
您应该检查~/Library/Logs/CoreSimulator/CoreSimulator.log它将为您记录底层错误。