0

I have set my NavigationBar height = 65 in constraint. When the device is in landscape position, the height is still no change. I would like make the height in shorter may be about 40px. I don't want to change or set to width. I just only need for height of navigation bar.

How to implement this with swift?

enter image description here

enter image description here

May Phyu
  • 895
  • 3
  • 23
  • 47
  • I tried many examples. But not working for me. I don't know where I am wrong. Mostly, they write for width. I don't want to set default width. – May Phyu Jun 06 '16 at 03:33

1 Answers1

0

You can't change navigation bar's height.

If you want navigation bar with custom height then you can make custom navigation bar using UIView behave as navigation bar.

First you should hide actual navigationbar then take uiview with origin (0,0), means it's x and y should be (0,0) and it's width should be self.view.frame.size.width i.e. same width as screen width and set height like 65 or 70 or whatever you required. Take buttons to behave as back button or else and take a label for screentitle in bottom middle of that view.

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75
  • Please view my screenshot images. I put UINavigationBar to the view and I set constraint. When I rotate the device, the height is also 64. I want to set the height 50 when the device is in Landscape mode. Where should I write the code to implement this? – May Phyu Jun 06 '16 at 03:23
  • Take outlet of height constraint and then change it's constant to 50 when rotate the device. – Ketan Parmar Jun 06 '16 at 04:43
  • can u please show me example of device orientation code? – May Phyu Jun 06 '16 at 06:32