Reputation: 3003
I have a UIViewController
inside of UINavigationViewController
. I use navigationController
.toolbar
for some actions.
There's no problem until the first device rotation. After it toolbar goes off the screen frame.
And there's nothing to be done, even another device rotations can't fix this. The problem occurs only on IPad ios v.6. The code is very simple:
- (void)createToolbar{
UIImage *toolbarBack = [[UIImage imageNamed:@"navbar"] resizableImageWithCapInsets:UIEdgeInsetsMake(2, 2, 2, 2)];
[self.navigationController.toolbar setBackgroundImage:toolbarBack forToolbarPosition:UIBarPositionBottom barMetrics:UIBarMetricsDefault];
self.navigationController.toolbar.delegate = self;
//...
self.toolbarItems = @[item1, space, item2, space, item3, space, item4];
}
- (void)showToolbar{
[self.navigationController setToolbarHidden:YES animated:NO];
}
#pragma mark - toolbar delegate methods
- (UIBarPosition)positionForBar:(id<UIBarPositioning>)bar{
return UIBarPositionBottom;
}
UPDATE I found out that before the rotation navigationController.view.height == 1004 and after the rotations it increase by 20 (1024). Is it some statusbar issue?
Upvotes: 2
Views: 934
Reputation: 25459
Set up toolbar delegate to your view controller and implement method:
- (UIBarPosition)positionForBar:(id <UIBarPositioning>)bar {
return UIBarPositionBottom;
}
If you use storyboard you can create constraint between bottom of the screen and your toolbar.
Upvotes: 2