I have a UITableView and a Detail View embedded in a UINavigationController as so: I would like to turn on large titles for "My Notes" but I'd like to turn it off for the detail view. Something like how the default Mail app works on iPhone. How would I change the navigation bar's prefersLargeTitle
property during that segue?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- SwiftUI: UIImage (QRCode) does not load after call
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Using if let syntax in switch statement
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Xcode: Is there a way to change line spacing (UI L
- Enum with associated value conforming to CaseItera
- Swift - hide pickerView after value selected
Any one of both of following, will solve your problem:
set prefersLargeTitles to false for your navigationBar
set largeTitleDisplayMode to never for navigationItem (note: prefersLargeTitles must be false otherwise this won't work)
Note: if
prefersLargeTitles
is true, then largeTitleDisplayMode = .never won't work. Small title display for navigation bar is dependent onprefersLargeTitles
This will enable large title mode if it's value is true
I had the same issue just now.
My use case:
MasterVC: basic navigation bar without largeTitle
DetailVC: largeTitle enabled
--> When going back to the MasterVC from the DetailVC I was seeing a weird animation which showed a largeTitle on the Master for a sec before going back to the basic non largeTitle layout. It looked like a glitch.
I fixed it by following this approach:
In MasterVC - viewDidLoad
In DetailVC - viewDidLoad
I hope that can help others.
It should be noted that if you set
largeTitleDisplayMode
to never, andprefersLargeTitles
to false on a detailViewController
, the small title will continue to display for a second when moving from the detailViewController
to the previousViewController
via theUINavigationBar
back button.Use
willMove(toParent:)
function to change the title back before the segue is performed.Swift 4
It might be very late but this could be useful for someone..
include the below code on your detail view controller under viewDidLoad
it's very simple.
In your DetailView you should set navigationItem.largeTitleDisplayMode to .never
(not navigationController?.navigationItem.largeTitleDisplayMode !!)