2011-05-26 151 views
0

HII每一個如何隱藏在標籤點擊標籤欄在iPhone應用程序

我做了多視圖的應用程序,因爲我有4個選項卡,, &我在每個選項卡視圖控制器,在一個選項卡中,我已經分組了表格視圖控制器,點擊該選項卡它將進入該分組表格視圖,每一件事情都很好,但表格的最後一行隱藏在標籤欄下,所以我需要隱藏標籤欄當我進入該屏幕,我怎麼能做到這一點,,任何一個可以幫助我

我在AppDelegate中使用這種以編程方式創建標籤,

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 

    UINavigationController *localNavigationController; 
    tabBarController = [[UITabBarController alloc] init]; 
    NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:5]; 

    //add first tab View Controller 
    RootViewController *ViewController; 
    ViewController = [[RootViewController alloc] initWithTabBar]; 

    localNavigationController = [[UINavigationController alloc] initWithRootViewController:ViewController]; 
    [localControllersArray addObject:localNavigationController]; 
    [localNavigationController release]; 
    [ViewController release]; 

    //add second tab View Controller 
    StudentDataEntry *GroupViewController; 
    GroupViewController = [[StudentDataEntry alloc] initWithTabBar]; 
    localNavigationController = [[UINavigationController alloc] 
           initWithRootViewController:GroupViewController]; 
    [localControllersArray addObject:localNavigationController]; 
    [localNavigationController release]; 
    [GroupViewController release]; 
} 

thanx提前

回答

0

如果你的最後一行是不是在你的視圖中可見那麼就沒有必要隱藏標籤欄爲您已按照讓你的表視圖高度,標籤欄是48 PX如此從桌面視圖高度減去這個48像素高度,並且如果頂部有一個導航欄,那麼也會從高度減去44個像素,然後它將可見。此外,您還可以爲表格視圖設置內容插入以使其可見。

+0

雅真的作品,感謝名單了很多 – Ravi 2011-05-26 04:38:00

0

試試這個

yourviewcontroller.hidesBottomBarWhenPushed=YES; 
0

我希望這可以幫助您

BOOL hiddenTabBar = NO; 

- (void) hidetabbar { 




NSArray *array = self.tabBarController.view.subviews; 
NSLog(@"array SubView %@",array); 
[UIView animateWithDuration:1.0 delay:0.0f options:UIViewAnimationCurveLinear animations:^(){ 
    for(UIView *view in self.tabBarController.view.subviews) 
    { 

     if([view isKindOfClass:[UITabBar class]]) 
     { 

      if (hiddenTabBar) { 
       [view setFrame:CGRectMake(view.frame.origin.x, 431, view.frame.size.width, view.frame.size.height)]; 
      } else { 
       [view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)]; 
      } 
     } else { 
      if (hiddenTabBar) { 
       [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 431)]; 
      } else { 
       [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)]; 
      } 

     } 
    } 
} completion:^(BOOL isfinsihed){ 
    hiddenTabBar = !hiddenTabBar; 

}]; 




}