In the Photos app, the Collections title doesn't collapse into a small inline title when scrolling, unlike a standard inline large title display mode. How is this implemented?
Non-collapsing title
You can achieve this with the following code in your view controller:
navigationItem.style = .editor // Left align title view
navigationItem.titleView = titleLabel
Thanks, that works! Here's the SwiftUI version:
.navigationTitle("Collections") // needed for the back button menu
.toolbarTitleAlignment(.leading) // or .toolbarRole(.editor)
.toolbarTitleDisplayMode(.inline) // or .navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .principal) {
Text("Collections")
.font(.largeTitle.bold())
}
}
Is there a way to get the same result without a custom toolbar item?