How can I change height of Navigation Bar - Swift 3

You can create a class based on UINavigationBar like this

class TTNavigationBar: UINavigationBar {

    override func sizeThatFits(_ size: CGSize) -> CGSize {
        return CGSize(width: UIScreen.main.bounds.width, height: 55)
    }

}

And add it to your NavigationController.


You can write this code in class that extends UINavigationController

override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
    let height = CGFloat(72)
    navigationBar.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: height)
}

UPDATE 8/3/20: I posted this in 2016. A number of people have stated this no longer works so please use at your own risk. I am not working in iOS at the moment so I do not have an update handy. Best of luck!

Here is one way to do it:

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    let height: CGFloat = 50 //whatever height you want to add to the existing height
    let bounds = self.navigationController!.navigationBar.bounds
    self.navigationController?.navigationBar.frame = CGRect(x: 0, y: 0, width: bounds.width, height: bounds.height + height)
    
}