Leverage the ability to change the app icon in iOS 10.3+.
- Titanium Mobile SDK 6.0.3.GA or later
- iOS 10.3 or later
- Xcode 8.3 or later
Unzip the module in the modules/iphone/
folder of your project.
Add the module requirement in your tiapp.xml
file.
<modules>
<module platform="iphone">ti.alternateicons</module>
</modules>
In order to use this module with Titanium you will need to disable app thinning by editing the adding the following property in your tiapp.xml
:
<ios>
<use-app-thinning>false</use-app-thinning>
</ios>
Alternatively, you can pass the hashed name of the icon to the methods. You can look up the generated names in build/iphone/Assets.xcassets
.
Next, you have to declare the icons that you will use in your by adding the following to the tiapp.xml
. The <key>
named alloyIcon
is the string that you will use to call the setAlternateIconName
method .
<ios>
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>alloyIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>alloy</string>
</array>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon</string>
</array>
</dict>
</dict>
</dict>
</ios>
Copy your icons into the app/assets/
folder. You can try it out with [email protected]
and [email protected]
in the example folder of this repo.
This module is also built in Hyperloop to demonstrate the native API access with JavaScript.
You can simple require the ti.alternateicons.js
in your application and run it!
var AlternateIcon = require('ti.alternateicons');
if (AlternateIcon.isSupported()) {
AlternateIcon.setAlternateIconName('alloyIcon');
}
-
isSupported
-
supportsAlternateIcons
-
alternateIconName
-
setAlternateIconName
-
setDefaultIconName
Cesar Cavazos (@cesarcvz / Web)
Apache 2.0
Code contributions are greatly appreciated, please submit a new pull request
To Hans Knoechel because this module was created using titanium-review-dialog as a reference