refamondo.blogg.se

Custom app icons
Custom app icons













  1. #Custom app icons software
  2. #Custom app icons code

Setting the icon in the app designer overrides the table definition icon setting.

#Custom app icons software

ShowAlert() here is a method I wrote that will display an UIAlertController with a UIAlertAction telling users that they need a software version update.Īnd there we have it! Thanks for reading.All image files must be no more than 10 kilobytes in size. We pass in an Error parameter that will be set to a value error if something goes wrong, and if it does, let’s go ahead and print the localizedDescription on the error. You can optionally provide a completion handler to be run when the call finishes.

custom app icons

If it does, we will set the alternate icon with the instance method setAlternateIconName and pass in the image name that we declared in our ist. (We need our iOS version to be 10.3 for this to work seamlessly) func newIconTapped(_ sender: UIButton) įirst, let’s check if our app allows us to switch to an alternate icon by checking the supportsAlternateIcons property on our application.

custom app icons

works similarly in that you specify the iOS release you want to target, and Xcode handles the rest. Now, the power of #available is that the compiler can now check and enforce API usage on older operating system. To reset your icon to the primary icon, set the alternate icon to nil: (nil) For example, you might also want to add a button that changes your app icon to AppIcon-3, like this: ("AppIcon-3") Once the button is pressed, the pop up view will show up and prompt the user to confirm if they want to change their default icon. To summarize, CFBundleIcons is a dictionary containing the key CFBundlePrimaryIcon and CFBundleAlternateIcons, each is a dictionary containing the key with your image filename, in which is another dictionary containing of the icon files and shine effect settings.į inally, let’s code! Now that we have our property list all set up, let’s implement the instance method setAlternateIconName(), which sets an alternate icon or can also be set as nil to display app’s default icon.Īs you can see in my storyboard screenshot above, I added a UIBarButtonItem and added an action on it. UIPrerenderedIcon specifies whether the app’s icon already includes a shine effect, false in this case. (Note that this doesn’t need to be their exact filenames, just however you want to reference each icon in your code) Each icon name is a dictionary which defines two keys as CFBundleIconFiles array and UIPrerenderedIcon boolean. The alternate icons key (CFBundleAlternateIcons) is a dictionary containing the keys of its children, which are the names of icon images you are using. The primary icon key itself is also a dictionary that lists all of its icon files (CFBundleIconFiles), which is an array containing the filename for your primary icon as a string.

custom app icons

#Custom app icons code

What this code does is that it looks into the CFBundleIcons key, which is a dictionary that defines your primary icon ( CFBundlePrimaryIcon) and your alternate icons ( CFBundleAlternateIcons). At the end of your property list you should see the following: ĭirectly before, go ahead and add this: CFBundleIcons CFBundlePrimaryIcon CFBundleIconFiles app_icon_114x114 UIPrerenderedIcon CFBundleAlternateIcons AppIcon-2 CFBundleIconFiles app_icon_purple_120x120 UIPrerenderedIcon AppIcon-3 CFBundleIconFiles app_icon_green_120x120 UIPrerenderedIcon This will reveal the raw XML behind your plist. N ow let’s register your custom icons in ist! Right click on your ist file, and choose Open As -> Source Code.















Custom app icons