1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
- (void)changeIcon{
if ([UIApplication sharedApplication].supportsAlternateIcons) { NSLog(@"you can change this app's icon"); }else{ NSLog(@"you can not change this app's icon"); return; }
NSString *iconName = [[UIApplication sharedApplication] alternateIconName]; NSLog(@"%@",iconName); if (iconName) { // change to primary icon [[UIApplication sharedApplication] setAlternateIconName:@"appIcon1" completionHandler:^(NSError * _Nullable error) { if (error) { NSLog(@"set icon error: %@",error); } NSLog(@"The alternate icon's name is %@",iconName); }]; }else{ // change to alterante icon [[UIApplication sharedApplication] setAlternateIconName:@"appIcon2" completionHandler:^(NSError * _Nullable error) { if (error) { NSLog(@"set icon error: %@",error); } NSLog(@"The alternate icon's name is %@",iconName); }]; } }
|
近期评论