39f*_*edy 7 xcode navigationbar swiftui watchos-6
在上图中,id 喜欢更改-02:49为一种颜色,例如Color.blue
我试过了:
struct ContentView: View {
var body: some View {
PlayerView().accentColor(Color.blue)
}
}
Run Code Online (Sandbox Code Playgroud)
我还尝试将它添加到实际的 PlayerView 中,如下所示:
struct PlayerView: View {
var body: some View {
VStack{
....
}.navigationBarTitle(Text(“-2:49”))
.accentColor(.blue)
}
}
Run Code Online (Sandbox Code Playgroud)
我也试过:
struct PlayerView: View {
var body: some View {
VStack{
....
}.navigationBarTitle(Text(“-2:49”).foregroundColor(.blue))
}
}
Run Code Online (Sandbox Code Playgroud)
Anj*_*iya 11
在这一点上,为了改变 navigationBarTitle 的颜色,他们在 SwiftUI 中没有直接的 api。
但你可以改变它这样,
1)进入Interface.storyboard文件里面的AppName WatchKit App。
2) 选择Hosting Controller Scene,转到File Inspector并更改Global Tint为您的自定义颜色。
如果有人想更改 WatchOS 中导航标题的颜色,请使用以下代码
.navigationTitle {
Text("Header").foregroundColor(.blue)
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2129 次 |
| 最近记录: |