【问题标题】:In Tab-based iPhone app, how to hide the tabbar in some ViewControllers?在基于 Tab 的 iPhone 应用中,如何在某些 ViewController 中隐藏标签栏?
【发布时间】:2011-10-23 16:37:26
【问题描述】:

我有一个基于标签栏的 iPhone 应用程序。

该应用由 2 个标签组成。 每个选项卡都有一个带有 3 个 ViewController 的导航控制器。

如何防止 TabBar 显示在其中一个 ViewController 中(因为它已经有自己的 TabBar 导航)?

【问题讨论】:

    标签: iphone uitabbarcontroller


    【解决方案1】:

    找到了这个,感谢原始海报:

    Is it possible to hide the tabbar when a button is pressed to allow a full screen view of the content?

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    
    if (appDelegate.navigationController.navigationBar.hidden == NO)
    {
        [[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
        [appDelegate.navigationController setNavigationBarHidden:YES animated:YES];
    
        [UIView beginAnimations:@"HideTabbar" context:nil];
        [UIView setAnimationDuration:.2];
        self.view.frame = CGRectMake(0,0,320,480);
        [UIView commitAnimations];
    }
    if (appDelegate.navigationController.navigationBar.hidden == YES)
    {
        [[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
        [appDelegate.navigationController setNavigationBarHidden:NO animated:YES];
    
        [UIView beginAnimations:@"ShowTabbar" context:nil];
        [UIView setAnimationDuration:.2];
        self.view.frame = CGRectMake(0,0,320,368);
        [UIView commitAnimations];
    }   
    }
    

    【讨论】:

    • self.hidesBottomBarWhenPushed = YES; 谢谢!
    猜你喜欢
    • 1970-01-01
    • 2011-08-24
    • 1970-01-01
    • 1970-01-01
    • 2011-09-08
    • 1970-01-01
    • 2012-02-04
    • 1970-01-01
    • 2019-04-05
    相关资源
    最近更新 更多