iOS 11 Beta 1 uses the increased navigation-bar title for almost all system-apps (it started doing this in iOS 10 and the Music app). I am wondering if Apple has a public API for this coming in iOS 11, or whether it will stay private for now.
The behavior is that the title has an increased font-size, is left aligned and will move to the navigation-bar once the user scrolls down. I've attached some screens showing this behavior in the Messages app here.
Although I could not find any reference in the UINavigationController
and UINavigationBar
so far, maybe someone knows some more details!
UINavigationBar
has aprefersLargeTitles: Bool
property. Docs here.UINavigationItem
has alargeTitleDisplayMode: UINavigationItem.LargeTitleDisplayMode
property. Docs here.Both of these can be modified in the Interface Builder.
To turn on this behavior set
navigationController.navigationBar.prefersLargeTitles
totrue
. Then you can control each individual view controller in the navigation controller stack by settingnavigationItem.largeTitleDisplayMode
.The general design guidelines by Apple are that large titles shouldn't be used everywhere (for example, the Clock app does not use them), and it's generally preferred that only the first level of the navigation controller uses the large titles. However, these are just general guidelines.
Large titles are introduced in What's New in Cocoa Touch video (7:37).
Note that there are some bugs in beta 1 which cause the large title to only appear when you manually scroll up.
The only change done to
UINavigationBar
API for iOS 11 isprefersLargetitles
only. check hereYou can do it to your own apps with one small change: check "Prefers Large Titles" for your navigation bar in IB, or if you prefer to do it in code using
Edit
If you need to change the text attributes of the large title you need to use the new
largeTitleTextAttributes
property onUINavigationBar
:Update for Swift 4.2:
As
NSForegroundColorAttributeName
has been renamed toNSAttributedString.Key.foregroundColor
, use:Just check the "Prefers Large Titles" at Navigation Bar attribute inspector