ChikabuZ
ChikabuZ

Reputation: 10215

Large navigation bar custom height

Is it possible to change large navigation bar height?

self.navigationItem.largeTitleDisplayMode = .always 
self.navigationController?.navigationBar.prefersLargeTitles = true
self.navigationController?.navigationBar.addSubview(expandedNavBar)

Upvotes: 0

Views: 1716

Answers (2)

ChikabuZ
ChikabuZ

Reputation: 10215

Ok, I found this way:

let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.minimumLineHeight = 200
let attributes: [NSAttributedString.Key: Any] = [ .paragraphStyle: paragraphStyle]

let navigationBar = navigationController?.navigationBar
if #available(iOS 13, *) {
    if let appearance = navigationBar?.standardAppearance {
        appearance.largeTitleTextAttributes = attributes
        navigationBar?.standardAppearance = appearance
        navigationBar?.scrollEdgeAppearance = appearance
    }
} else {
    navigationBar?.largeTitleTextAttributes = attributes
}

Upvotes: 0

Omer Tekbiyik
Omer Tekbiyik

Reputation: 4764

I dont think you can change navigationBar height because of Apple HIG. If you want to change navigationBar height , you can remove navigationBar and you can show your own customview to user like navigationBar

If you want to make the navigationBar a little bigger, you can try this trick by adding an empty string to the prompt property.

self.navigationItem.prompt = ""

Upvotes: 1

Related Questions