Xcode 6 GM iPhone 6 Simulator - 故事板大小不正确,显示为放大
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25754395/
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
Xcode 6 GM iPhone 6 Simulator - Storyboards not sizing correctly, appear zoomed in
提问by arcticmatt
I'm using the new Xcode 6 GM Seed and testing my app on the iPhone 6 and iPhone 6 Plus simulators. I'm getting a strange effect on some projects I was previously working on, namely that the views seem to be getting a "zoom in" effect.
我正在使用新的 Xcode 6 GM Seed 并在 iPhone 6 和 iPhone 6 Plus 模拟器上测试我的应用程序。我对我之前从事的一些项目产生了奇怪的影响,即视图似乎得到了“放大”效果。
Here's an example. Both these view controller's are exactly the same (minus the different navigation item text), down to the label text size. However, you can see that the views appear different.
这是一个例子。这两个视图控制器完全相同(减去不同的导航项文本),直到标签文本大小。但是,您可以看到视图看起来不同。
Note that the project with the weird zoom effect has a deployment target of 8.0.
请注意,具有奇怪缩放效果的项目的部署目标为 8.0。
Note: I got the normal looking one to work by making the project in the new Xcode 6 GM Seed (the projects that aren't working were made on older versions of Xcode).
注意:通过在新的 Xcode 6 GM Seed 中制作项目(不起作用的项目是在旧版本的 Xcode 上制作的),我得到了正常的工作。
回答by rmaddy
This is the default and this is how all existing apps will work on the new iPhones - they will be "zoomed".
这是默认设置,也是所有现有应用程序在新 iPhone 上运行的方式——它们将被“放大”。
To make an app that actually uses the extra screen size you must, like with the 4" iPhones, add specific launch images specific to the two iPhone 6's.
要制作实际使用额外屏幕尺寸的应用程序,您必须像使用 4" iPhone 一样,添加特定于两个 iPhone 6 的特定启动图像。
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 添加新的启动图像。您可能需要右键单击并选择“添加新启动图像”以查看添加新图像的位置。
In addition, using a Launch Screen xib file instead of images solves this problem right away and it's the recommended way moving forward. Here are the steps to add a Launch Screen to your app: https://stackoverflow.com/a/25763870/422288
此外,使用 Launch Screen xib 文件而不是图像可以立即解决此问题,这是向前推进的推荐方式。以下是向您的应用程序添加启动屏幕的步骤:https: //stackoverflow.com/a/25763870/422288
回答by Vince Yuan
Adding Launch Image does not solve this problem.
添加 Launch Image 并不能解决这个问题。
You need to add LaunchScreen.xib into the project and add Launch screen interface file base name
- LaunchScreen
to Info.plist
需要在项目中添加 LaunchScreen.xib 并添加Launch screen interface file base name
- LaunchScreen
到 Info.plist
Create a new project with Xcode 6 GM. You will see what LaunchScreen.xib is. You can copy it into your existing project.
使用 Xcode 6 GM 创建一个新项目。您将看到 LaunchScreen.xib 是什么。您可以将其复制到现有项目中。
回答by JScarry
It doesn't look like Apple updated the docs yet for the new launch image sizes, but you can find them from Xcode. If you add the new launch images as Maddy says, you can view the new sizes in the inspector panel. iOS 8 includes three new images and does not require different images if the Status Bar is hidden on launch. The sizes are:
看起来 Apple 尚未针对新的启动图像大小更新文档,但您可以从 Xcode 中找到它们。如果您像 Maddy 所说的那样添加新的启动图像,则可以在检查器面板中查看新尺寸。iOS 8 包含三个新图像,如果状态栏在启动时隐藏,则不需要不同的图像。尺寸是:
iOS 8 iPhone Portrait
Retina HD 5.5 1242x2208
Retina HD 4.7 750x1334
iOS 8 Landscape
Retina HD 5.5 2208x1242
You can add them in Xcode or edit the json file in the .xcassets file and drop the images into the package. If you choose to edit the package, add these lines to the top of the file:
您可以在 Xcode 中添加它们或编辑 .xcassets 文件中的 json 文件并将图像放入包中。如果您选择编辑包,请将这些行添加到文件顶部:
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "[email protected]",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "[email protected]",
"minimum-system-version" : "8.0",
"orientation" : "landscape",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "667h",
"filename" : "[email protected]",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "2x"
}
I kept the naming convention they used before for the portrait files. There was never a landscape option on phones before, so I kept the naming convention for iPads. Of course, you can name them anything you want.
我保留了他们之前用于肖像文件的命名约定。以前手机上从来没有横向选项,所以我保留了 iPad 的命名约定。当然,您可以随意命名它们。
Edit: Note that the only phone that will launch in landscape mode is the iPhone 6 Plus. The rest of the phones will only launch in portrait mode.
编辑:请注意,唯一能以横向模式启动的手机是 iPhone 6 Plus。其余手机将仅以纵向模式启动。
回答by 0oneo
most of what @rmaddy said works, but when I goto the Images.xcassets to configure the LaunchImage, I just select the "LaunchImage", and select "Attributes inspector", in the inspector page, you will see the corresponding configure choices, the steps also works for App Icons
@rmaddy 所说的大部分内容都有效,但是当我转到 Images.xcassets 配置 LaunchImage 时,我只需选择“LaunchImage”,然后选择“属性检查器”,在检查器页面中,您将看到相应的配置选项,步骤也适用于应用程序图标
回答by Maciek Czarnik
@JScarry, your solution is ok, but doesnt allow to show landscape image on iPhone 6. Here is a solution that works(it requires both landscape and portrait images to be in the same dimension 350x667, landscape image should be just rotated)
@JScarry,您的解决方案没问题,但不允许在 iPhone 6 上显示横向图像。这是一个有效的解决方案(它要求横向和纵向图像的尺寸相同 350x667,横向图像应该只是旋转)