I've got a custom UIToolBar which doesn't adjust it's height to match the navigationbar on the top of the screen when I rotate to landscape mode. The height stays the same which makes it look a bit weird. The default toolbar from the UINavigationController actually reduces in size when rotated to landscape (unfortunately I can't use it because of push/pop transition issues). The current resizing mask is :
[ customToolbar setAutoresizingMask: ( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin ) ];
If I add "UIViewAutoresizingFlexibleHeight" strange things happen...so I'm not quite sure if I should use this.
Please let me know if anyone knows the correct way to auto resize/rotate the UIToolBar to match the navigationbar height.
If you need to resize your custom toolbar with the same aspect ratio as standard navigation bar you should implement willAnimateRotationToInterfaceOrientation controller method like this:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
CGRect navigationToolbarFrame = self.navigationController.navigationBar.frame;
CGRect customToolbarFrame = CGRectOffset(navigationToolbarFrame, 0.0, navigationToolbarFrame.size.height);
[UIView animateWithDuration:duration animations:^{
self.customToolbar.frame = customToolbarFrame;
}];
}