How to get the Navigation Bar height in iOS?

iOSApps/ApplicationsMobile Development

A navigation bar appears at the top of an app screen. To read more about it

Getting height of Navigation bar becomes important if you’ve multiple view controllers having different UI and requirement. It becomes hectic if you’re not aware how to get the height of the same or modify as per need. Let’s see how we can get the height of Navigation bar.

import UIKit
class ViewController: UIViewController {
   override func viewDidLoad() {
      let navBarHeight = UIApplication.shared.statusBarFrame.size.height +
         (navigationController?.navigationBar.frame.height ?? 0.0)
Published on 08-Jul-2019 07:49:03