我有一个 UIViewController
标签栏内。对于选项卡栏中的一个 VC,我允许界面在设备旋转时旋转。挑战是,我想隐藏标签栏并调整我的 View 大小。
我做了什么:
1) 调用- (void)willAnimateRotation....
在我的标签栏 Controller 中设置 self.tabBar.isHidden
为 true -> 标签栏消失了。
2) 调用- (void)willAnimateRotation....
并设置self.mapView.frame
到最大高度。
但是...我在屏幕底部仍然有一个与标签栏大小完全相同的黑色条纹。有没有办法让标签栏完全消失?
最佳答案
[self hideTabBar:self.tabBarController];
- (void) hideTabBar:(UITabBarController *) tabbarcontroller {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
[view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
}
}
[UIView commitAnimations];
}
关于iphone - 用 View 覆盖标签栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12370748/