[英]SwiftUI: macOS Can't change TabView's tabItem accent color
TabView {
Text("The First Tab")
.badge(10)
.tabItem {
Image(systemName: "1.square.fill")
Text("First")
}
Text("Another Tab")
.tabItem {
Image(systemName: "2.square.fill")
Text("Second")
}
Text("The Last Tab")
.tabItem {
Image(systemName: "3.square.fill")
Text("Third")
}
}
.font(.headline)
.accentColor(.orange) // don't work on macOS
在 macOS 12.4 (21F79) 和 iOS 15.4 上进行测试。 无法更改默认的重音蓝色。
在 macOS 上可以这样更改:
struct ContentView: View {
init() {
UserDefaults.standard.set(1, forKey: "AppleAccentColor") // << here !!
}
var body: some View {
TabView {
使用 Xcode 13.4 / macOS 12.4 测试
*参见其他值https://stackoverflow.com/a/51695756/12299030
**还有一些相关的 https://stackoverflow.com/a/68846972/12299030
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.