2012-04-11 4 views
0

탭바에 4 개 이상의 옵션이있는 앱을 설계하고 있습니다. 원하는 모든보기가 푸시되고있을 때 탭바를 숨기고보기가 다시 표시 될 때 다시 표시하는 것입니다. 나는 hidesbottomwhenpushed 시도로 꺼내하지만 당신이 보여주고 싶은 경우이 기능보기가 푸시 될 때 iphone + 탭바 숨기기

[self hideTabBar:self. tabbarcontroller]; 

를 호출 할 때

+0

할 수 있습니까? 그 코드를 어떻게 보여줄 수 있습니까? – Ilanchezhian

+0

사실 내가 한 것은 tabbarcontrollers 옵션을 "xbed를 통해 밀어 넣을 때 숨김"옵션을 선택했다는 것입니다. 누락 된 부분이 있습니다. – Shantanu

답변

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

} 

도움이 제발, 작동하지 않았다 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]; 
} 
+0

매우 유용합니다! 나는 그것에 대한 질문이 있습니다 : 프레임을 변경하는 대신 UITabBar 뷰를 숨길 수 없습니까? –

+0

앱 delegete에서 탭 표시 줄을 사용하고 있습니까? – Deepesh

+0

현재 모델보기 컨트롤러 (간단한 방법)를 사용하십시오 – Deepesh

관련 문제