I'm working in iOS6, and my UIToolbar isn't getting any thinner in height when the device rotates, though it is widening to cover the increased length. Here's my code:
-(void)loadToolBar:(NSString *)t {
//Creates a toolbar.
[bar removeFromSuperview];
if (UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation])) {
bar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 480, 32)];
}
else bar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
bar.autoresizingMask=UIViewAutoresizingFlexibleWidth;
bar.autoresizingMask=UIViewAutoresizingFlexibleHeight;
bar.autoresizingMask=UIViewAutoresizingFlexibleBottomMargin;
}
I also added this method from UIToolbar height on device rotation, but it doesn't seem to have made a difference:
- (void) layoutForInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Adjust the toolbar height depending on the screen orientation
CGSize toolbarSize = [bar sizeThatFits:self.view.bounds.size];
bar.frame = (CGRect){CGPointMake(0.f, CGRectGetHeight(self.view.bounds) - toolbarSize.height), toolbarSize};
webV.frame = (CGRect){CGPointZero, CGSizeMake(CGRectGetWidth(self.view.bounds), CGRectGetMinY(bar.frame))};
}
Any thoughts about what I'm doing wrong?