0

タブバーに 4 つ以上のオプションがあるアプリを設計しているので、ビューがプッシュされているときにタブバーを非表示にし、ビューがポップされたときに再び表示するだけで、hidesbottomwhenpushed を試しましたが、うまくいきませんでした私。助けてください

4

1 に答える 1

1

この機能を使用する

- (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];

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]; 
}
于 2012-04-11T12:51:39.203 に答える