如何在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];
}
预先感谢     
已邀请:
如果最后一行在视图中不可见,则无需隐藏选项卡栏,因为您必须根据其设置表格视图的高度,因此选项卡栏为48像素,因此减去表格视图高度的48像素高度并且如果顶部有导航栏,则高度也要减去44 px,然后它才可见。此外,您还可以设置表格视图的内容插图以使其可见。     
尝试这个
yourviewcontroller.hidesBottomBarWhenPushed=YES;
    
希望对您有帮助
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;

}];




}
    

要回复问题请先登录注册