我开始在iOS 6下编写该应用程序,设法解决了图像和不推荐使用的API的所有问题。
我正在创建一个支持iOS 7样式的新图标,但是无论我是否使用资产目录和/或图像的直接路径,只要我在启动应用程序时添加新参考,就会得到一个黑色图标。
我显然做错了。
这是我的资产目录,显示所有映射的图像。它们实际上并未显示在应用程序中,并且我在所有iOS应用程序中都有黑色图标。
每当我启动时,我都会得到一个黑色图标。它与Info.plist文件中的某些设置有关吗?
这里是。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIcons</key>
<dict/>
<key>CFBundleIcons~ipad</key>
<dict/>
<key>CFBundleIdentifier</key>
<string>com.neckbeardrepublic.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>7.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIAppFonts</key>
<array>
<string>Lato-Black.ttf</string>
<string>FontAwesome.ttf</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIStatusBarHidden</key>
<false/>
<key>UIStatusBarHidden~ipad</key>
<true/>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleDefault</string>
<key>Translucent</key>
<false/>
</dict>
</dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
极其沮丧。我也只是尝试提供特定文件而没有太多用处。
谁能找出问题所在?
首先,检查您用于应用程序图标的图像文件是否合适。有关完整的详细信息,请参阅Apple的《 App图标上的人机界面指南》,但与以下问题特别相关:
避免透明。应用程序图标应该是不透明的。如果图标的边界小于建议的大小,或者您使用透明效果创建“透视”区域,则生成的图标似乎漂浮在黑色背景上,这在用户选择的精美壁纸上看起来尤其没有吸引力。
如果您使用的是透明性,例如透明背景上的黑色图像,则该图标在iOS中可能会完全显示为黑色。
接下来,有几种方法可以告诉iOS您的应用程序图标。新机制是使用资产目录;苹果有一个有关迁移应用程序图标或启动图像集的指南。
旧的简单方法是将图标文件名添加到Info.plist文件中CFBundleIcons
。根据Apple在与应用程序相关的资源上的文档:
无论您的应用程序有多少个不同的图标,您都可以使用文件中的
CFBundleIcons
键来指定它们Info.plist
。该键的值是一个字符串数组,每个字符串都包含一个图标的文件名。文件名可以是您想要的任何名称,但是所有图像文件都必须为PNG格式,并且必须位于应用程序捆绑包的顶层。(避免使用隔行扫描的PNG。)当系统需要一个图标时,它将选择大小最接近预期用途的图像文件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句