![这里写图片描述](https://img-blog.csdn.net/20180521164612166?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3l5eXljY2xs/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>Test1</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Test1</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>Test2</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Test2</string>
</array>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon60x60</string>
</array>
</dict>
</dict>
-(void)setIcon:(UISegmentedControl *)sender
{
// Can the app select a different icon?
if ([[UIApplication sharedApplication] respondsToSelector:@selector(supportsAlternateIcons)]) {
NSLog(@"可以改变icon");
switch (sender.selectedSegmentIndex) {
case 0:
[[UIApplication sharedApplication] setAlternateIconName:nil completionHandler:^(NSError * _Nullable error) {
NSLog(@"error = %@", error.localizedDescription);
}];
break;
case 1:
[[UIApplication sharedApplication] setAlternateIconName:@"Test1" completionHandler:^(NSError * _Nullable error) {
NSLog(@"error = %@", error.localizedDescription);
}];
break;
case 2:
[[UIApplication sharedApplication] setAlternateIconName:@"Test2" completionHandler:^(NSError * _Nullable error) {
NSLog(@"error = %@", error.localizedDescription);
}];
break;
default:
break;
}
} else {
NSLog(@"当前版本太低,必须ios 10.3以上!!!");
}
}