1.配置info.plist文件
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon</string>
</array>
</dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>blueIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>blueIcon</string>
</array>
</dict>
<key>AppIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>redIcon</key>
<dict>
<key>UIPrerenderedIcon</key>
<false/>
<key>CFBundleIconFiles</key>
<array>
<string>redIcon</string>
</array>
</dict>
<key>otherIcon</key>
<dict>
<key>UIPrerenderedIcon</key>
<false/>
<key>CFBundleIconFiles</key>
<array>
<string>otherIcon</string>
</array>
</dict>
</dict>
</dict>
2 添加图片
3 代码实现
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.3)
{
if ([UIApplication sharedApplication].supportsAlternateIcons) {
[[UIApplication sharedApplication] setAlternateIconName: completionHandler:^(NSError * _Nullable error) {
}];
}
}
看效果