iOS10.3+动态修改App icon

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>

image.png

2 添加图片

image.png

3 代码实现

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.3)
    {
        if ([UIApplication sharedApplication].supportsAlternateIcons) {
          
            [[UIApplication sharedApplication] setAlternateIconName: completionHandler:^(NSError * _Nullable error) {
                
            }];
          
        }
        
    }

看效果

image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,860评论 18 139
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,016评论 25 708
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,936评论 6 342
  • 发现 关注 消息 iOS 第三方库、插件、知名博客总结 作者大灰狼的小绵羊哥哥关注 2017.06.26 09:4...
    肇东周阅读 12,198评论 4 61
  • 未遇见你之前,这世上的花草都与我无关。美虽美矣,终究不过脚下一抔黄土。 认识你之后,我却为整个世界倾倒,满目皆春花...
    _Sophie_阅读 361评论 1 2