隐藏tabBar
- (void) hideTabBar:(BOOL) hidden{
[UIView beginAnimations:nil context:NULL];
if (hidden){
[UIView setAnimationDuration:0];
}
else {
[UIView setAnimationDuration:0];
}
for(UIView *view in self.tabBarController.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
if (hidden) {
[view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
} else {
[view setFrame:CGRectMake(view.frame.origin.x, 431, view.frame.size.width, view.frame.size.height)];
}
}
else
{
if (hidden) {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
} else {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 431)];
}
}
}
[UIView commitAnimations];
}
-(void)setTabBarHidden:(BOOL)bol{
if(bol == YES)//隐藏
{
[MenuTabBarCtrl.view setFrame:CGRectMake(0, 0, 320, 530)];
NSArray *views = [MenuTabBarCtrl.view subviews];
for(id v in views){
if([v isKindOfClass:[UITabBar class]]){
[(UITabBar *)v setHidden:YES];
}
}
}else {//显示
[MenuTabBarCtrl.view setFrame:CGRectMake(0, 0, 320, 480)];
NSArray *views = [MenuTabBarCtrl.view subviews];
for(id v in views){
if([v isKindOfClass:[UITabBar class]]){
[(UITabBar *)v setHidden:NO];
}
}
}
}