iOS 7应用程序图标在我添加新图像时立即显示黑色

myu*_*uf3 8 icons image ios ios7 xcode5

我开始在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>
Run Code Online (Sandbox Code Playgroud)

非常令人沮丧.我也试过提供具体的文件,但也没有多大用处.

任何人都可以查明这个问题吗?

pix*_*x0r 17

首先,检查您用于应用图标的图像文件是否合适.有关完整详细信息,请参阅Apple关于应用程序图标的人机界面指南,但与此问题特别相关:

避免透明度.应用图标应该是不透明的.如果图标的边界小于建议的尺寸 - 或者您使用透明度来创建"透视"区域 - 结果图标可能看起来漂浮在黑色背景上,这在用户选择的漂亮壁纸上看起来特别缺乏吸引力.

如果您使用透明度,例如透明背景上的黑色图像,则图标在iOS中可能会显示为黑色.

接下来,有几种方法可以告诉iOS有关您应用的图标.新机制是使用资产目录; Apple提供了有关迁移应用程序图标或启动图像集的指南.

旧的,简单的方法是将图标文件名添加到Info.plist文件中CFBundleIcons.根据Apple关于App相关资源的文档:

无论您的应用程序有多少不同的图标,您都可以使用文件中的CFBundleIcons密钥指定它们Info.plist.该键的值是一个字符串数组,每个字符串都包含一个图标的文件名.文件名可以是您想要的任何内容,但所有图像文件必须采用PNG格式,并且必须位于应用包的顶层.(避免使用隔行扫描的PNG.)当系统需要图标时,它会选择尺寸最接近预期用途的图像文件.

  • @ myusuf3我更新了答案以包含使用透明PNG的警告;) (2认同)