Default Navigation bar height is 64.But after change it's orientation to landscape navigation bar height changed to 28.I want to set Fix navigation bar size in all orientation.
Asked
Active
Viewed 888 times
1 Answers
1
You can add orientation observer:
NotificationCenter.default.addObserver(self, selector: #selector(rotated), name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil)
And add rotate method:
func rotated() {
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)
}

maxwell
- 3,788
- 6
- 26
- 40
-
1thanks for response.still not resolved.@maxwell navigation bar changes height 44 to 32 in landscape.Below that navigation bar I placed search bar with height 56.Still shows some space in between navigation bar and search bar in landscape – Vinayak Bhor Mar 04 '18 at 19:33