UINavigationBar elevation and terrain mode

If I use the UINavigationController to display my UINavigationBar, this panel is much thinner in landscape mode than in portrait mode.

Everything is still, since I want this behavior, but I have one view that is not handled by the UINavigationController, and so I just dragged the UINavigationBar from the Interface Builder into the view, but this one is always the same size and I don’t see a way to tell the UINavigationBar. that he should resize.

Does anyone know how to achieve this?

+4
source share
1 answer

You can resize the navigation bar in the layoutSubviews method of your UIView, for example:

- (void)layoutSubviews { [super layoutSubviews]; // Let navBar tell us what height it would prefer at the current orientation CGFloat navBarHeight = [navBar sizeThatFits:self.bounds.size].height; // Resize navBar navBar.frame = CGRectMake(0, 0, self.bounds.size.width, navBarHeight); } 
+10
source

All Articles