使用 Xcode 5 在 iOS 7 中启动图像
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18758882/
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
Launch Images in iOS 7 with Xcode 5
提问by Anden87
I've been setting my own names on launch images for my apps in the Info.plist like
我一直在为我的应用程序在 Info.plist 中的启动图像上设置我自己的名字
with the following images in bundle (with correct dimensions, 320x480 px for default.png and 640x960 px for [email protected] etc.)
使用捆绑中的以下图像(具有正确的尺寸,default.png 为 320x480 像素,[email protected] 为 640x960 像素等)
this have been working great prior to iOS 7 and Xcode 5. Now when I look in the General tab for the corresponding target in Xcode 5 my launch image files get mixed up from other targets in my project, which worries me, even though I haven't seen wrong launch image files when actually running the target. Should I be worried? The chosen images isn't in the build target so I should be fine there, but is there a risk of getting a blank image instead?
这在 iOS 7 和 Xcode 5 之前运行良好。现在,当我在 Xcode 5 中查看相应目标的常规选项卡时,我的启动图像文件与项目中的其他目标混淆,这让我担心,即使我没有在实际运行目标时没有看到错误的启动图像文件。我应该担心吗?选择的图像不在构建目标中,所以我在那里应该没问题,但是是否有获得空白图像的风险?
My main question is, can I use my default setup in Info.plist (that help auto detected respective launch images) for iOS 7, and if so, what should I name the corresponding launch images (now that there's the "iOS 6.1 and Prior" options as well with different dimensions)? This especially applies for the iPad Portrait Retina (iOS 7) that has new dimensions. The auto detection on iPad Portrait Non-Retina (iOS 7) refers to an image, not in the build target, that has the right dimensions. Again, when running a simulator with iPad Retina and iOS 7.0 the correct launch image shows.
我的主要问题是,我可以在 Info.plist 中使用我的默认设置(帮助自动检测各自的启动图像)用于 iOS 7,如果是这样,我应该为相应的启动图像命名什么(现在有“iOS 6.1 和之前的” " 选项以及不同的尺寸)?这尤其适用于具有新尺寸的 iPad Portrait Retina (iOS 7)。iPad Portrait Non-Retina (iOS 7) 上的自动检测是指具有正确尺寸的图像,不在构建目标中。同样,当使用 iPad Retina 和 iOS 7.0 运行模拟器时,会显示正确的启动图像。
回答by guthook
Anden, I ran into the same problem today while adding a new target to the half dozen I already had that were set up in the same way that you set up yours.
Anden,我今天遇到了同样的问题,同时向我已经拥有的六个目标添加了一个新目标,这些目标的设置方式与您设置的方式相同。
I decided to use that "Use Asset Catalog" button, which took some work to set up, but has simplified things greatly in the end:
我决定使用“使用资产目录”按钮,这需要一些工作来设置,但最终大大简化了事情:
1- (optional) Delete (remove references only) the icon and launch image files from your project. I don't think you need the files to be in the project navigator anymore.
1-(可选)从项目中删除(仅删除引用)图标并启动图像文件。我认为您不再需要将文件放在项目导航器中。
2- Choose your primary target, go to "General" and "App Icons" (as you showed above).
2- 选择您的主要目标,转到“常规”和“应用程序图标”(如上所示)。
3- Press the "Use Asset Catalog" button, with the "Migrate Launch Images" checked as well.
3- 按下“使用资产目录”按钮,同时选中“迁移启动图像”。
4- This creates a file called "Images.xcassets" in your project navigator. Go there, and find the App Icon and Launch Image catalogs corresponding with the particular target. You can drag and drop image files from the finder into the slots in the catalog, and rename the icon/default groups from the list on the left.
4- 这会在您的项目导航器中创建一个名为“Images.xcassets”的文件。去那里,找到与特定目标相对应的应用程序图标和启动图像目录。您可以将图像文件从查找器拖放到目录中的插槽中,并从左侧的列表中重命名图标/默认组。
5- Once you've got the image slots filled up, go back to the "General" for each target, and press the "Use Asset Catalog" button again for each target. Instead of creating a new xcassets file for each, you can store all the launch images and icon files in the same xcassets file.
5- 填满图像槽后,返回每个目标的“常规”,然后再次为每个目标按下“使用资产目录”按钮。您可以将所有启动图像和图标文件存储在同一个 xcassets 文件中,而不是为每个文件创建一个新的 xcassets 文件。
回答by RickJansen
I think it is a bug in xcode 5. I filed a bug, perhaps you should too (bugreport.apple.com). Make Apple aware things like this are not working well, and are taking our time and nerves.
我认为这是 xcode 5 中的一个错误。我提交了一个错误,也许你也应该(bugreport.apple.com)。让 Apple 意识到这样的事情不能很好地运作,并且正在耗费我们的时间和精力。