Info
In iOS 10.3, the function to change app icons has been added, which allows you to change the icon without updating the app.
How to add
In Project
- minimum target version : iOS 10.3
- Add the alternate icons onto project
- I haven't found a way to use Assets yet
- Add
CFBundleIcons
parameter in app’sInfo.plist
file
// Info.plist
...
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>icon_type_1</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>icon1</string> // <- added the alternate icon name
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>icon_type_2</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>icon2</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>icon_type_3</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>icon3</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon60x60</string> // <- Assets AppIcon
</array>
</dict>
</dict>
...
In Code
- Setting the alertnate Icon
if ([[UIApplication sharedApplication] supportsAlternateIcons] == NO)
return;
[[UIApplication sharedApplication] setAlternateIconName:@"icon_type_1" //AlternateIcons key name
completionHandler:^(NSError * _Nullable error) {
NSLog(@"%@", [error description]);
}];
- Reset to the primary icon
if ([[UIApplication sharedApplication] supportsAlternateIcons] == NO)
return;
[[UIApplication sharedApplication] setAlternateIconName:nil
completionHandler:^(NSError * _Nullable error) {
NSLog(@"%@", [error description]);
}];
반응형
'Programming > iOS - ObjC' 카테고리의 다른 글
[NSArray] 배열에 있는 모든 객체에서 같은 함수 호출하기 (0) | 2018.05.07 |
---|---|
CLLocation - 두 점사이 거리 구하기 (0) | 2017.03.19 |
Layer - 그림자 넣기 (0) | 2017.03.19 |
[APNs] Push notification 등록 (iOS10 대응) (0) | 2016.12.11 |
ObjectiveC와 Javascript 상호 호출 (0) | 2015.07.09 |
UILabel - 특정 범위 색상 변경 (0) | 2015.07.09 |
Device type check (0) | 2015.07.09 |
CATransition - UINavigation push animation (0) | 2015.07.09 |
UIAlertView - TextField 추가 (0) | 2015.07.09 |
NSString - Base64 Encoding/Decoding (0) | 2015.06.30 |