深圳注册投资公司的条件李勇seo博客
Xcode: 14.3.1
更改 App 图标
- 淘宝,支付宝,有道翻译有时候会随着运营活动去调整图标,比如 双 11。(这个很简单,替换一下 AppIcon 就可以了)
- Github App 提供了多套图标可以修改。(需要配置 & 写代码)这篇博客主要来搞这个。
第一种方式,现在 2023 年准备一张 1024 * 1024 的图片就可以了,之前需要十几种各种尺寸的,吐血。
第二种方法就需要一些繁琐的步骤了
1. 新建一些 AppIcon1 AppIcon2 AppIcon3… 备选用
2. Build Settings -> 过滤 App Icon
3. 将 Include All App Icon Assets No 改为 Yes
4. 将 AppIcon1 AppIcon2 AppIcon3… 添加到 Alternate App Icon Sets
5. Next show me the code…
@AppStorage("setting_active_app_icon") var setting_active_app_icon = ""Picker(selection: $setting_active_app_icon) {Text("红色").tag("AppIcon1")Text("橙色").tag("AppIcon2")Text("黄色").tag("AppIcon3")Text("绿色").tag("AppIcon4")Text("蓝色 - 默认").tag("AppIcon5")
} label: {Text("更改图标")
}
.onChange(of: setting_active_app_icon) { newValue inprint("更改图标 Picker onChange", newValue, type(of: newValue))UIApplication.shared.setAlternateIconName(newValue) { (error) inif let error = error {print("Failed request to update the app’s icon: \(error)")}}
}