Jan R
Jan R

Reputation: 11

iOS 11 - Use large titles as a navigation (Swift)

I recently found an app with a really interesting navigation (utilizing the large titles in iOS11) I want to adapt into my private app. So I started searching for a way to create it but I didn't find out how to create multiple large titles that are linked with the current "page" so you could just click any of the entries to get to the actual page.

I uploaded a video to YouTube showing the navigation, so you can understand it better: https://youtu.be/IAaxhjWmDQ0

Thanks in advance

Upvotes: 1

Views: 1862

Answers (1)

Alejandro Viquez
Alejandro Viquez

Reputation: 163

If you want to have LargeTitles on iOS Navigation bar on Swift4, you need to set this option to true

navigationController?.navigationBar.prefersLargeTitles = true

and then, set always display the content of large title

navigationItem.largeTitleDisplayMode = .always

additional if you want to customize the title of navigation bar, you need to set the appereance

UINavigationBar.appearance().prefersLargeTitles = true
UINavigationBar.appearance().largeTitleTextAttributes = 
    [NSAttributedStringKey.foregroundColor: UIColor.blue, 
     NSAttributedStringKey.font: UIFont(name: "Papyrus", size: 30) ?? 
                                 UIFont.systemFont(ofSize: 30)]

"Papyrus" is the font custom in the project

credits to: https://chariotsolutions.com/blog/post/large-titles-ios-11/

Upvotes: 5

Related Questions