我想要改变我的navigationBarTitle的颜色(不是背景)。我尝试了几种方法,但是当我打开屏幕时,标题文字颜色只有在我向下滚动时才会改变。
var body: some View {
ZStack{
NavigationView{
ScrollView{
LazyVStack{
ForEach(storeArray,id:\.id) { item in
Image(uiImage: (item.banner?.url)!.load())
.resizable()
.frame(width: CGFloat(UIScreen.main.bounds.width * 0.9), height: CGFloat((UIScreen.main.bounds.width / CGFloat((item.banner?.ratio) ?? 1))))
.cornerRadius(12)
.shadow(radius: 4)
.aspectRatio(CGFloat((item.banner?.ratio)!), contentMode: .fit)
}
}
}
.navigationBarTitle(Text("United App").foregroundColor(.blue))
.background (NavigationConfigurator { nc in
nc.navigationBar.titleTextAttributes = [.foregroundColor : UIColor.blue]
})
}
.onAppear {
if isOpened != true {
getStoreResponse()
}
}