Reputation: 814
I have basic list and detail views set up as shown below. The problem is that the first detail view shows "< Inbox" as the back button while the other rows show "< Back". I've tried various options and places for .navigationBarTitle
but haven't found any way to solve this.
Main / list view:
var body: some View {
NavigationView {
List {
ForEach(userData.message) { messageSection in
Section(header: Text(messageSection.id)) {
ForEach(messageSection.messages) { message in
NavigationLink(destination: MessageDetail(message: message)) {
MessageRow(message: message)
}
}
}
}
}.navigationBarTitle(Text("Inbox"), displayMode: .inline)
}
}
Detail view:
var body: some View {
ScrollView {
VStack {
...
}
}.navigationBarTitle(Text("\(self.message.title) (\(self.message.preview))"), displayMode: .inline)
}
Upvotes: 2
Views: 760
Reputation: 14388
When the title is too long to display in the space allocated for the left bar button, the system uses "Back" as the button title instead.
Upvotes: 3