I need to change the color of Application Icon programmatically in iOS.
I’m working on theme based application, where I need to apply theme colors on visual contents of the application, that user selects from a list of colors. The complete app is working fine (able to change colors of all components according to the theme selected by the user) except application Icon
.
Is there any way to change/reset application icon/image programmatically. Or I can change app icon/Image tint color?
Here is the same question with both positive & negative answers and both are upvoted. (Can I change app icon programmatically). It creates confusion, whether it is possible or not. And if yes, then how can I do that?
Note: I have requirement different than other questions/answers, I have a list of colors (around 25) in-app and I need to change icon color, according to user's selection of color, from the app. Can anyone guide a proper way to utilize/use a single set of app icons and apply different colors on it?
It is possible to change appIcon from iOS 10.3. For this you need to set supportsAlternateIcon
to Yes
in info.plist. Both primary and secondary icons should be added in CFBundleIcons key of your app's Info.plist file.
To change App Icon following UIApplication method is to be called:
func setAlternateIconName(_ alternateIconName: String?, completionHandler: ((Error?) -> Void)? = nil)