Navigation Bar Height
I have a view that I whipped up in Interface Builder which has some content and a nav bar at the top. Typically throughout the iPhone UI, when 开发者_开发知识库the device is rotated to landscape, the nav bars get slightly shorter (in height). However, mine stays the same when rotated in any orientation. Is this some quirk about doing it through IB or am I missing a property somewhere? Thanks!
Your problem is the autoresizingMask
of the UINavigationBar
that you've added via IB. You need to change it but IB unfortunately (maybe a bug) doesn't allow us to add the UIViewAutoresizingFlexibleHeight
option. So you will need to do it programmatically,
navBar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin;
Typically, a UIToolbar
will stay the same size. If your viewController
is of UINavigationController
class, the height of the bar should conform to rotation.
精彩评论