Home > front end >  Large navigation bar custom height
Large navigation bar custom height

Time:03-22

Is it possible to change large navigation bar height?

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

CodePudding user response:

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 = ""

CodePudding user response:

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 15, *) {
    if let appearance = navigationBar?.standardAppearance {
        appearance.largeTitleTextAttributes = attributes
        navigationBar?.standardAppearance = appearance
        navigationBar?.scrollEdgeAppearance = appearance
    }
} else {
    navigationBar?.largeTitleTextAttributes = attributes
}
  • Related