Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use the increased navigation-bar title in iOS 11

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:

enter image description here

Although I could not find any reference in the UINavigationController and UINavigationBar so far, maybe someone knows some more details!

like image 598
Hans Knöchel Avatar asked Jun 07 '17 09:06

Hans Knöchel


People also ask

How do I change the navigation bar on my iPhone?

A user changes the navigation bar's style, or UIBarStyle , by tapping the “Style” button to the left of the main page. This button opens an action sheet where users can change the background's appearance to default, black-opaque, or black- translucent.

What is navigation bar in iOS?

A navigation bar appears at the top of an app screen, enabling navigation through a hierarchy of content. A navigation bar also provides a natural place to display a screen's title — helping people orient themselves in your app or game — and it can include controls that affect the screen's content.

What is navigation bar height iOS?

iPhone X added extra height for the Home Bar to toolbars and tab bars and their sizes are unchanged from iOS 11: 83 points tall in portrait and 53 points tall in landscape.


1 Answers

The only change done to UINavigationBar API for iOS 11 is prefersLargeTitles.

Documentation here: https://developer.apple.com/documentation/uikit/uinavigationbar/

You 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:

navigationController?.navigationBar.prefersLargeTitles = true 

If you need to change the text attributes of the large title you need to use the new largeTitleTextAttributes property on UINavigationBar:

UINavigationBar.appearance().largeTitleTextAttributes = [     NSAttributedString.Key.foregroundColor: UIColor.black ] 
like image 60
Moin Shirazi Avatar answered Oct 05 '22 23:10

Moin Shirazi