如何在SwiftUI中更改导航栏标题颜色
NavigationView {
List {
ForEach(0..<15) { item in
HStack {
Text("Apple")
.font(.headline)
.fontWeight(.medium)
.color(.orange)
.lineLimit(1)
.multilineTextAlignment(.center)
.padding(.leading)
.frame(width: 125, height: nil)
Text("Apple Infinite Loop. Address: One Infinite Loop Cupertino, CA 95014 (408) 606-5775 ")
.font(.subheadline)
.fontWeight(.regular)
.multilineTextAlignment(.leading)
.lineLimit(nil)
}
}
}
.navigationBarTitle(Text("TEST")).navigationBarHidden(false).foregroundColor(.orange)
}
我尝试过.foregroundColor(.orange)
但是没有效果
还尝试了.navigationBarTitle(Text("TEST").color(.orange))
ZStack
并将其内部的Rectangle
偏移至导航区域下方屏幕外找到了一种 hacky 的方法。请查看 - https://dev59.com/gdL7oIgBc1ULPQZFtM6a#75278773 - ansavchenco