在上图中,id 想更改 -02:49
到一种颜色,例如 Color.blue
我试过了:
struct ContentView: View {
var body: some View {
PlayerView().accentColor(Color.blue)
}
}
和
我还尝试将它添加到实际的 PlayerView 中,如下所示:
struct PlayerView: View {
var body: some View {
VStack{
....
}.navigationBarTitle(Text(“-2:49”))
.accentColor(.blue)
}
}
我也试过:
struct PlayerView: View {
var body: some View {
VStack{
....
}.navigationBarTitle(Text(“-2:49”).foregroundColor(.blue))
}
}
最佳答案
在这一点上,为了改变 navigationBarTitle 的颜色,他们在 SwiftUI 中没有直接的 api。
但是你可以像这样改变它,
1) 转至 Interface.storyboard
您的 AppName WatchKit App
中的文件.
2) 选择 Hosting Controller Scene
, 转至 File Inspector
并更改 Global Tint
到您的自定义颜色。
关于xcode - SwiftUI 中 watchOS 的 NavigationBarTitle 颜色更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58035341/