IOS 显示和隐藏tabbar

-(void)hideTabBar:(UITabBarController*) tabbarcontroller {
[UIViewbeginAnimations:nilcontext:NULL];
[UIViewsetAnimationDuration:0.5];
for(UIView*viewintabbarcontroller.view.subviews)
{
if([viewisKindOfClass:[UITabBarclass]])
{
[viewsetFrame:CGRectMake(view.frame.origin.x,480, view.frame.size.width, view.frame.size.height)];
}
else
{
[viewsetFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width,480)];
}

}

[UIViewcommitAnimations];





}

-(void)showTabBar:(UITabBarController*) tabbarcontroller {

[UIViewbeginAnimations:nilcontext:NULL];
[UIViewsetAnimationDuration:0.5];
for(UIView*viewintabbarcontroller.view.subviews)
{
NSLog(@"%@", view);

if([viewisKindOfClass:[UITabBarclass]])
{
[viewsetFrame:CGRectMake(view.frame.origin.x,431, view.frame.size.width, view.frame.size.height)];

}
else
{
[viewsetFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width,431)];
}


}

[UIViewcommitAnimations];
}

你可能感兴趣的:(ios)