I have a quite simple question but the answer is not so easy.
I want to hide a UITabBar when my orientation change.
I looked 2 ways :
Frame way
myAppDelegate.tabBarController.tabBar.frame = CGRectMake(<<bottomOfScreen>>);
Works fine but I have a blank area, so tried to play with tabBarController.view.frame et myViewController.view.frame but I didn't get any good result.
Navigation Controller Way
myOtherVC.hideTabBarWhenPushed = YES;
[self.navigationController pushViewController:myOtherVC animated:NO];
Works but isn't a good solution for my app
Update:
[appDelegate.tabBarController.view removeFromSuperview];
[self.view removeFromSuperview]; [appDelegate.window addSubview:self.view];
self.view.frame = CGRectMake(0,0,480,320);
Works fine but doesn't autorotate anymore (and of course, I didn't change the shouldAutorotate and it always returns YES)
How can I hidde my tabBar and make the current view taking its space ?
Thanks
You can use the current solution combined with:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
to detect rotation. (I think that you combine this with view.transform = CGAffineTransformMakeRotation to make it rotate...?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With