iphone+;按下任何视图时隐藏选项卡栏
我正在设计一个在tabbar中有4个以上选项的应用程序,所以我只想在推任何视图时隐藏tabbar,并在弹出视图时再次显示它。我在推视图时尝试了HidesBottom,但对我无效。请帮助使用此功能iphone+;按下任何视图时隐藏选项卡栏,iphone,ios,uitabbarcontroller,Iphone,Ios,Uitabbarcontroller,我正在设计一个在tabbar中有4个以上选项的应用程序,所以我只想在推任何视图时隐藏tabbar,并在弹出视图时再次显示它。我在推视图时尝试了HidesBottom,但对我无效。请帮助使用此功能 - (void) hideTabBar:(UITabBarController *) tabbarcontroller { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0
- (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];
}
当您正在调用此函数时
[self hideTabBar:self. tabbarcontroller];
- (void) showTabBar:(UITabBarController *) tabbarcontroller {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
for(UIView *view in tabbarcontroller.view.subviews)
{
NSLog(@"%@", view);
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];
}
当您想要显示tabbarcontroller时,请使用此功能
[self hideTabBar:self. tabbarcontroller];
- (void) showTabBar:(UITabBarController *) tabbarcontroller {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
for(UIView *view in tabbarcontroller.view.subviews)
{
NSLog(@"%@", view);
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];
}
你能展示你是如何做到这一点的吗?实际上,我所做的是通过xib选择了tabbarcontrollers选项“按下时隐藏底部”。我缺少什么吗?非常有用!我有一个问题:他不能只隐藏UITabBar视图而不更改其框架吗?你在app Deleget中使用选项卡栏吗?请使用当前的模型视图控制器(简单方式)