ChenYilong / ChenYilong/iOS11AdaptationTips
Use the increased navigation-bar title in iOS 11
- Dominant language
- No language data
- Stars
- 477
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
Q:
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). What is the public API for this coming in iOS 11.
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
image1 | image2
-------------|-------------
 | 
A:
`UINavigationBar` has a `prefersLargeTitles: Bool` property. [Docs here][1].
class UINavigationBar {
var prefersLargeTitles: Bool
}
`UINavigationItem` has a `largeTitleDisplayMode: UINavigationItem.LargeTitleDisplayMode` property. [Docs here][2].
class UINavigationItem {
var largeTitleDisplayMode: LargeTitleDisplayMode
}
Both of these can be modified in the Interface Builder.
To turn on this behavior set `navigationController.navigationBar.prefersLargeTitles` to `true`. Then you can control each individual view controller in the navigation controller stack by setting `navigationItem.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.
It's introduced in [What's New in Cocoa Touch video][3].
[1]: https://developer.apple.com/documentation/uikit/uinavigationbar/2908999-preferslargetitles
[2]: https://developer.apple.com/documentation/uikit/uinavigationitem/2909056-largetitledisplaymode
[3]: https://developer.apple.com/videos/play/wwdc2017/201/
Reference: [Use the increased navigation-bar title in iOS 11](https://stackoverflow.com/questions/44409173/use-the-increased-navigation-bar-title-in-ios-11)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.