2

Is it possible to change the UINavigationBar height in ios 11? I've tried this:

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)

}

and this:

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

and none of them seem to work.

dre_84w934
  • 678
  • 8
  • 27
  • 2
    You might be able to do it, but my advice would be to stop wanting to. Certainly you should not mess with the height of a navigation controller's navigation bar, because that is up to the navigation controller, which needs to be able to set it and change it on its own account. – matt May 27 '18 at 17:26
  • This might be helpful for u - https://stackoverflow.com/questions/32142375/changing-the-height-of-the-navigation-bar-ios-swift – Rashed May 27 '18 at 17:57
  • did you ever get this working? @dre_84w934 – SomeGuyFortune Apr 11 '19 at 22:10

0 Answers0