本文介绍了支持iOS6和iOS7的启动屏幕 - 强制启动屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当谈到启动屏幕时,我找不到一种统一的方式来模仿iOS6和iOS7上的应用程序外观(支持两者)。如果我们有工具栏菜单,或者你们有什么好主意如何解决它,我们是否被迫制作一个标识或类似的常规闪屏?

When it comes to the launch screen I can't find a unifying way to mimic the look of the application on both iOS6 and iOS7 (supporting both). Are we forced to make a regular splash screen of a logo or similar if we have a toolbar menu or do you guys have any great ideas how to solve it?

推荐答案

简短回答



在iOS 7中,应用可以使用不同的启动图像,具体取决于它运行的iOS版本。提供不同的启动图像,将 UILaunchImages 键添加到Info.plist文件中,并使用字典描述每个启动图像。

Short answer

In iOS 7, an app can use a different launch image depending on which version of iOS it’s running in. To provide different launch images, add the UILaunchImages key to the Info.plist file and use a dictionary to describe each launch image.

它使用以下键:

在磁盘上,您的图像文件名可能仍然包含@ 2x,-568h,
~iphone或~ipad修饰符(尽管它们不是
) 。当
选择要加载的文件时,系统会自动考虑此类修饰符。

On disk, your image filenames may still include the @2x, -568h, ~iphone, or ~ipad modifiers as appropriate, although they are not required. The system automatically accounts for such modifiers when choosing which file to load.

UILaunchImageMinimumOSVersion - 对于iOS7,这应该是一个字符串 7.0。

UILaunchImageMinimumOSVersion - for iOS7 this should be a string "7.0".

UILaunchImageOrientation - 包含以下内容之一的字符串:Portrait,PortraitUpsideDown,Landscape,LandscapeLeft,LandscapeRight。

UILaunchImageOrientation – String containing one of: Portrait, PortraitUpsideDown, Landscape, LandscapeLeft, LandscapeRight.

UILaunchImageSize - String 指定宽度和高度,例如:{320,480}。您必须以纵向方向指定设备的宽度和高度
。换句话说,定位同一设备的纵向和
风景图像将具有相同的宽度
和高度。

UILaunchImageSizeString specifying width and height, ex: "{320, 480}". You must specify the width and height with respect to the device in a portrait orientation. In other words, portrait and landscape images targeting the same device would have the same width and height.

如果此键存在,iOS 7专门用于获取发射
图像。

If this key is present, iOS 7 uses it exclusively to obtain launch images.

但是我发现坚持iOS7的命名约定帮了很多忙!

BUT: I found that sticking to the naming convention also for iOS7 helped a lot!



好的 - 所以现在是什么?



因为我已经拥有iOS6的启动图像以及所有特定的命名约定。我选择复制所有这些副本,并在名称前添加iOS7-,以限制我对所有不同大小和名称的混淆。制作一个前缀应该会派上用场,因为大多数图像会立即正确加载。

OK – so now what?

Because I already had launch images for iOS6 and with all their specific naming conventions. I chose to make a copy of all of them and prefix the name with "iOS7-" so as to limit my own confusion about all the different sizes and names. Making a prefix should prove to come in handy as then most of the images would immediately be loaded correctly.

文件名:
我已经为iOS6提供了这些,我还列出了有需要的人的文件大小:

The filenames:I had these for iOS6 already, I also list the file sizes for those in need:


  • Default.png (320x480)

  • [email protected] (640x960)

  • 默认@ 2x~ipad .png (2048x1496)

  • 默认~ipad.png (768x1004)

  • Default1024x768.png (1024x768)

  • [email protected] (2048x1536)

  • [email protected] (640x1136)

  • Default768x1024.png (768x1024)

  • [email protected] (1536x2048 )

  • Default-Landscape~ipad.png (1024x748)

  • Default-Portrait@2x~ipad.png (1536x2048)

所以我为iOS7制作了所有这些文件名的副本(相同的大小),为它们添加了前缀hiOS7 - :

So I made a copy of all of these filenames for iOS7 (same sizes) prefixing them with "iOS7-":


  • iOS7-Default.png

  • iOS7-Default @ 2x。 png

  • ...

现在在PLIST中创建您的条目。转到your-name-of-application.plist。在空白区域中,右键单击并选择添加行。确保它成为顶级项目,而不是.plist中某些其他信息的子项。

Now to create your entry in PLIST. Go to your-name-of-application.plist. In a blank area, right-click and choose "Add Row". Make sure it becomes a top item and not a sub-item of some other information in the .plist.

写:
UILaunchImages

右键单击此UILaunchImages并选择值类型Array。

Right-click on this UILaunchImages and select value type "Array".

使用下面的插图作为文本的指南以及文本全部完成时的外观:

Use the illustration below as a guide to the text and for how it will look when it is all finished:

如果你打开这个数组,那么左边的小指示三角形指向下方,它第一次是空的,但如果你在打开时选择添加行,它将创建一个子行。现在就这样做:

If you open up this array so the little indicator triangle to the left points down, it is empty the first time, but if you choose "add row" while it is open it will create a sub-line. Do that now:

右键单击UILaunchImages并选择添加行。
右键单击此新行(项目0)并选择值类型Dict

Right-click on the UILaunchImages and select "Add row".Right-click on this new line (item 0) and select value type "Dict"

继续使用三角形指示符打开此项目并右键单击并添加行

Continue opening this items with the triangle indicator and right-click and "Add row"

此项目您将命名 UILaunchImageMinimumOSVersion 并将值类型设置为string并将字符串设置为7.0

This item you will name UILaunchImageMinimumOSVersion and set value type to "string" and the string to "7.0"

现在以下是所有字符串,应该与UILaunchImageMinimumOSVersion项目处于同一级别。在同一个词典(字典)。只需为每个选择添加行即可创建这些:

Now the following are all strings and should be at the same level as the UILaunchImageMinimumOSVersion item. In the same dict (dictionary). Create these by just choosing "Add row" for each:

UILaunchImageName - iOS7-的基本名称推出图像。在我的情况下,这是iOS7-Default

UILaunchImageName – base-name-of-iOS7-launch-image. In my case this was "iOS7-Default"

UILaunchImageOrientation - 示例:肖像

UILaunchImageSize - 基本尺寸iOS7-Default.png:{320,480}。程序将找到具有基本名称排列的所有文件。请记住选择不带ipad / iphone / portrait / landscape或.png规格的文件的基本名称。

UILaunchImageSize - the size of the elementary base iOS7-Default.png: "{320, 480}". The program will find all the files with permutations of the base name. Remember to select the base name of the file without ipad/iphone/portrait/landscape or .png specifications.

注意:

在所有可用的插槽中首次添加iOS6图像后,Xcode已经在.plist中为我制作了以下项目: - )

Xcode had already made the following items in the .plist for me after first adding iOS6 images in all available slots :-)

UILaunchImageFile~ipad ... =默认 - 所以这没关系

UILaunchImageFile~ipad … = "Default" – so this was OK

UILaunchImages~ipad ...有两个项目需要更新到iOS7版本,因为它们现在不正确持有iOS6版本。那些我命名为Default1024x768和Default768x1024的人,现在我只为每个名字添加了iOS7-,我就完成了。

UILaunchImages~ipad … Had two items that needed to be updated to iOS7 versions, because they where now incorrectly holding the iOS6 version. Those I had named Default1024x768 and Default768x1024 and now I just prefixed "iOS7-" to each of the names and I was done.

<key>UILaunchImages</key>
  <array>
    <dict>
      <key>UILaunchImageMinimumOSVersion</key>
      <string>7.0</string>
      <key>UILaunchImageName</key>
      <string>iOS7-Default </string>
      <key>UILaunchImageOrientation</key>
      <string>Portrait</string>
      <key>UILaunchImageSize</key>
      <string>{320, 480}</string>
    </dict>
  </array>

[由jd编辑:UILaunchImages的固定拼写]

[edit by jd: fixed spelling of "UILaunchImages"]

这篇关于支持iOS6和iOS7的启动屏幕 - 强制启动屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 05:15