I'm trying to get the navigation title vertically aligned with the back button in a NavigationDetail view in SwiftUI. Here's what this looks like currently:
Below's my code for adding the Navigation Bar title to the view. How do I get it vertically aligned with the Back button?
var body: some View {
Text("My Detail View")
.navigationBarTitleDisplayMode(.inline)
VStack {
List {
ForEach(0..<layerSettings.count, id: \.self) { each in
...
}
}
CodePudding user response:
If you need to draw "My Detail View" on the same line that the Back button, try to do like this:
NavigationView {
VStack() {
...
}
.navigationBarTitle(Text("My Detail View"),
displayMode: .inline)
}