带有视图的叠加标签栏 [英] Overlay tabbar with a view
问题描述
我在标签栏中有一个 UIViewController
。对于Tab栏中的一个VC,我允许界面在设备旋转时旋转。挑战在于,我想隐藏标签栏并调整我的视图。
I have a UIViewController
inside Tab bar. For one VC in Tab bar I allow the interface to rotate upon device rotation. The challenge is, that I want to hide the Tab bar and resize my view inside.
我做了什么:
1)在我的标签栏控制器中调用 - (void)willAnimateRotation ....
并设置 self.tabBar.isHidden
为true - >标签栏消失。
1) called - (void)willAnimateRotation....
in my Tab bar controller and set self.tabBar.isHidden
to true -> the Tab bar disappeared.
2)名为 - (void)willAnimateRotation ....
并将 self.mapView.frame
设置为最大高度。
2) called - (void)willAnimateRotation....
and set self.mapView.frame
to maximum height.
但是......我还有黑色条纹在屏幕底部的标签栏的确切大小。有没有办法让标签栏完全消失?
BUT...I still have a black stripe in the bottom of the screen in exact size of the tab bar. Is there a way how to make the tab bar disappeat completely?
推荐答案
[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];
}
这篇关于带有视图的叠加标签栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!