In my SwiftUI code, I have a tabbed view and inside tab view I have the following code:
NavigationView{
VStack{
Form{
Section(){
NavigationLink(destination: Text("Second View")) {
Text("Elaqe")
}
} // section
} //form
}
.modifier(NavBarModifier(font: self.fontUI,text: "Support"))
}
.navigationViewStyle(StackNavigationViewStyle())
When I click on the Nav link, I get the following:
it's barely readable and I would want to change it's color. How can I do this?
Edit 1: Apparently the back button's color depends on tabView's accentColor
. Is it possible to keep the accent color of tabbed view orange and change the back button's color to something else?
Edit 2: Nav bar Modifier
func body(content: Content) -> some View {
return content
.zIndex(0)
.animation(.spring())
.padding(.top,80)
.navigationBarTitle(Text(self.text),displayMode: .inline)
.navigationBarHidden(false)
.foregroundColor(.orange)
.background(NavigationConfigurator { nc in
nc.navigationBar.barTintColor = UIColor(red: 243/255, green: 107/255, blue: 21/255, alpha: 1)
nc.navigationBar.titleTextAttributes = [
.foregroundColor : UIColor.white,
.font : self.font,
.kern: 1.2
]
}
.padding([.top, .leading, .trailing]))
}
I had to change NavigationView
accentColor.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.