の.h
- (void) hideTabBarOfThisTabbarController:(UITabBarController *) tabbarcontroller withAnimationDuration:(int)duration;
- (void) showTabBarOfThisTabbarController:(UITabBarController *) tabbarcontroller withAnimationDuration:(int)duration;
.M
- (void) hideTabBarOfThisTabbarController:(UITabBarController *) tabbarcontroller withAnimationDuration:(int)duration{
[UIView transitionWithView:tabbarcontroller.tabBar duration:duration options: UIViewAnimationOptionCurveEaseInOut|UIViewAnimationOptionAllowUserInteraction animations:^(void) {
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)];
}
}
} completion:^(BOOL finished) {
NSLog(@"tabbar hidden");
}];
}
- (void) showTabBarOfThisTabbarController:(UITabBarController *) tabbarcontroller withAnimationDuration:(int)duration{
[UIView transitionWithView:tabbarcontroller.tabBar duration:duration options:UIViewAnimationOptionCurveEaseInOut|UIViewAnimationOptionAllowUserInteraction animations:^(void) {
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)];
}
}
} completion:^(BOOL finished) {
NSLog(@"tabbar shown");
}];
//u can call like this
//[self hideTabBarOfThisTabbarController:self.tabBarCon withAnimationDuration:3];
//if u want immediately hide/show the tabbar then duration should be 0.0
次のリンクをご覧ください。タブバーの表示と非表示を切り替えるのに役立ちます。 http://stackoverflow.com/questions/1209582/is-it-possible-to-hide-the-tabbar-when-a-button-is-pressed-to-allow-a-full-screen – iOS