Is there anyway to change the default Navigate-Back button color? I am using SwiftUI with NavigationView
2
-
Does stackoverflow.com/questions/28733936/… answer your question?luckystars– luckystars2020-06-25 02:47:13 +00:00Commented Jun 25, 2020 at 2:47
-
@luckystars SwiftUI does not involve the storyboard.El Tomato– El Tomato2020-06-25 02:55:35 +00:00Commented Jun 25, 2020 at 2:55
Add a comment
|
2 Answers
You can use the accentColor property on the NavigationView to set the back button color.
Example:
struct ContentView: View {
var body: some View {
NavigationView {
VStack {
NavigationLink(destination: DetailView()) {
Text("Show Detail View")
}.navigationBarTitle("Navigation")
}
}.accentColor(.red) // Replace it with required color.
}
}
AccentColor view modifier Sets the accent color for this view and the views it contains.
1 Comment
Rahul Umap
@John For further customisation, checkout this SO answer : stackoverflow.com/questions/56571349/…
NavigationView has two view modifiers that will probably meet your needs: foregroundColor and accentColor.
