我需要在一个视图控制器上隐藏UITabBar
。我试过了
vc.hideTabBarwhenpushed = TRUE
被推;这工作正常,但是当我在这个视图控制器上打开UITable
时,在UITabBar
所在的底部,在那个地方UITable
没有触及。
我试着做了
[viewController setWantsFullScreenLayout:YES];
但它没有用。
答案 0 :(得分:2)
使用此代码隐藏并显示您的tabBar
//隐藏标签栏
- (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];
}
//显示标签栏
- (void) showTabBar:(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, 431, view.frame.size.width, view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 431)];
}
}
[UIView commitAnimations];
}
答案 1 :(得分:0)
您需要确保正确设置表格视图的弹簧和支柱: