1

I use a custom height for the NavigationBar:

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

I also use a TabBar but when I press the more button to edit the bar, the height should be normal, because then the edit button cannot be pressed:

How can I specify a custom height of the NavigationBar just for some ViewControllers?

  • http://stackoverflow.com/questions/26380873/hide-status-bar-and-increase-the-height-of-uinavigationbar/26381417#26381417 – Kirit Modi Apr 10 '17 at 09:36

1 Answers1

0

To do so you need to add in the view controller of custom NavigationBar height:

var navBar: UINavigationBar = UINavigationBar()

func setNavBarToTheView() {
    self.navBar.frame = CGRectMake(0, 0, 320, 50)  // Here you can set you Width and Height for your navBar
    self.navBar.backgroundColor = (UIColor.blackColor())
    self.view.addSubview(navBar)
}

Reference to my answer: Changing the height of the Navigation bar iOS Swift

Community
  • 1
  • 1
Jaafar Barek
  • 420
  • 3
  • 9
  • Thanks for the answer, but in my app it adds a second NavigationBar. Is there a way to edit the original NavigationBar and not to add a new one? –  Apr 10 '17 at 11:36