如何在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)
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试过,.foregroundColor(.orange)但是没有用
也尝试过 .navigationBarTitle(Text("TEST").color(.orange))
有什么帮助吗?
我做了一个类似于下面看到的苹果的列表,但我真的不喜欢 UInavigation 栏的样子。理想情况下,我希望它更小或将其隐藏,以便我可以将自己的观点放在那里。
我试图通过使用苹果外观 api 中的以下内容来隐藏它
init() {
UINavigationBar.appearance().backgroundColor = .green
UINavigationBar.appearance().isHidden = true
}
Run Code Online (Sandbox Code Playgroud)
与拥有巨大的标题相比,即使拥有这样的导航栏也会更理想
但这没有影响,有没有人有任何建议或想法,我可以如何自定义它以使其更像我想要的那样?