Multiple lines for large titles in navigation bars in iOS 11

Viewed 4193

Is it possible to have the new large titles for navigation bars in iOS 11 show multiple lines? The App Store app does this but I can't find anything in the current documentation to do this. The standard behavior just shows one line with ellipsis if it's too long.

enter image description here

2 Answers

There is a way to do this simply by using a non-public API. Use at your own risk:

class ViewController: UIViewController {

   override func viewDidLoad() {
      super.viewDidLoad()
      title = "Thunderbox Entertaiment"
      navigationItem.enableMultilineTitle()
   }

}
extension UINavigationItem {
   
   func enableMultilineTitle() {
      setValue(true, forKey: "__largeTitleTwoLineMode")
   }
   
}

Result: enter image description here

Related