https://github.com/ccavazos/titanium-alternate-icons
Leverage the ability to change the app icon in iOS 10.3+
https://github.com/ccavazos/titanium-alternate-icons
appcelerator appcelerator-hyperloop titanium titanium-module
Last synced: about 1 year ago
JSON representation
Leverage the ability to change the app icon in iOS 10.3+
- Host: GitHub
- URL: https://github.com/ccavazos/titanium-alternate-icons
- Owner: ccavazos
- License: other
- Created: 2017-04-06T04:08:56.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-14T14:51:03.000Z (almost 9 years ago)
- Last Synced: 2024-11-16T00:33:18.336Z (over 1 year ago)
- Topics: appcelerator, appcelerator-hyperloop, titanium, titanium-module
- Language: Objective-C
- Size: 292 KB
- Stars: 24
- Watchers: 6
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Alternate App Icon Ti Module (iOS 10.3+)
### Summary
Leverage the ability to change the app icon in iOS 10.3+.

### Requirements
- Titanium Mobile SDK 6.0.3.GA or later
- iOS 10.3 or later
- Xcode 8.3 or later
### Download
* [Stable release](https://github.com/ccavazos/titanium-alternate-icons/releases)
### Setup
Unzip the module in the `modules/iphone/` folder of your project.
Add the module requirement in your `tiapp.xml` file.
```xml
ti.alternateicons
```
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`:
```xml
false
```
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 `` named `alloyIcon` is the string that you will use to call the `setAlternateIconName` method .
```xml
CFBundleIcons
CFBundleAlternateIcons
alloyIcon
CFBundleIconFiles
alloy
CFBundlePrimaryIcon
CFBundleIconFiles
AppIcon
```
Copy your icons into the `app/assets/` folder. You can try it out with `alloy@2x.png` and `alloy@3x.png` in the example folder of this repo.
### Hyperloop
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!
#### Example
```javascript
var AlternateIcons = require('ti.alternateicons');
if (AlternateIcons.isSupported()) {
AlternateIcons.setAlternateIconName('alloyIcon', function(e) {
if (!e.success) {
Ti.API.error(e.error);
}
});
}
```
#### Methods
- [x] `isSupported`
- [x] `supportsAlternateIcons`
- [x] `alternateIconName`
- [x] `setAlternateIconName`
- [x] `setDefaultIconName`
### Author
Cesar Cavazos ([@cesarcvz](https://twitter.com/cesarcvz) / [Web](http://ccavazos.co))
### License
Apache 2.0
### Contributing
Code contributions are greatly appreciated, please submit a new [pull request](https://github.com/ccavazos/titanium-alternate-icons/pull/new/master)
### Special Thanks
To [Hans Knoechel](https://github.com/hansemannn) because this module was created using [titanium-review-dialog](https://github.com/hansemannn/titanium-review-dialog) as a reference.