在保持触摸的同时按下时隐藏UITabBar
我需要在一个视图控制器上隐藏UITabBar
。 我试过了
vc.hideTabBarwhenpushed = TRUE
当推动; 这工作得很好,但是当我在这个视图控制器上打开一个UITable
,然后在UITabBar
应该在底部,在那个地方我的UITable
没有得到触摸。 我试过了
[viewController setWantsFullScreenLayout:YES];
但它没有工作。
您需要确保您正确设置了桌子视图的弹簧和支柱:
使用此代码来隐藏和显示您的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]; }