Change application icon programmatically

I saw this application in iTunes , it creates a custom icon in iphone. In my application, I also want to change the icon, especially what I want to do - there is one shortcut in my icon and programmatically I want to change the value of the label.

+3
source share
3 answers

From the video tutorial of the application, it seems that all they do is create a web page with a custom icon icon that you created, then the user clicks โ€œAdd to Home Screenโ€ to add a custom web page to the home screen. That should be enough to get you started.

+1
source

appIcon iOS 10.3.

Swift 3:

if UIApplication.shared.supportsAlternateIcons{
        UIApplication.shared.setAlternateIconName("icon2", completionHandler: { (error) in
            print(error ?? "")
        })
}

C:

[[UIApplication sharedApplication] setAlternateIconName:@"icon2" completionHandler:^(NSError * _Nullable error) {
        //NSLog(@"Error...");
}];

AlternateIcon Yes info.plist. , CFBundleIcons Info.plist.

//Info.plist
<key>CFBundleIcons</key>
<dict>
    <key>CFBundleAlternateIcons</key>
    <dict>
        <key>Icon1</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>icon1</string>
            </array>
            <key>UIPrerenderedIcon</key>
            <false/>
        </dict>
        <key>Icon2</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>icon2</string>
            </array>
        </dict>
    </dict>
</dict>

:

+1

It's impossible. If your application does not belong to the Newsstand category. For the newsstand application, change the icon using the code,

UIApplication *app = [UIApplication sharedApplication];
[app setNewsstandIconImage:newsstandImage];

Note. . What @Enrico offers is another solution. The icon of your application will still be present on the main screen, a duplicated icon will be created. Most users do not prefer.

0
source

All Articles