How can I enable an ios11 large title navigation bar? This is not working.
Asked
Active
Viewed 4,911 times
3 Answers
3
- Select ViewController
- Editor -> Embed in -> Navigation Controller
- Select NavigationController, select navigation bar
- Tick "Prefers Large titles" from attributes inspector
-
1What if I dont want to put my MyViewController inside a UINavigationController ? I just want a NavBar that has the LargeTitle Style. What he did is dragged a NavBar from the Controls, probably to customize it. – omarojo Mar 13 '19 at 23:29
0
self.title = "Your title"
if #available(iOS 11, *) {
self.navigationController?.navigationBar.prefersLargeTitles = true
self.navigationController?.navigationItem.largeTitleDisplayMode = .always
}
Please note that if you want to test this out you need at least:
- Xcode 9.0,
- Mac OSX - 10.12.6 or later,
- iPhone/iPad or Xcode 9 simulator with iOS 11.

Matic
- 393
- 3
- 12
-
1That's because the above is assuming your ViewController is inside a UINavigationController, and is not. You dragged a custom NavBar into your ViewController. You are making a custom NavBar that is just a UIView. for some reason the IB ignores the checkbox for largeTitles – omarojo Mar 13 '19 at 23:27
-2
override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 11, *) {
self.navigationController?.navigationBar.prefersLargeTitles = true
}
}
-
He is draggin and dropping a NavBar into his ViewController (not a UINavigationController). So what you posted is not going to work. – omarojo Mar 13 '19 at 23:25