如何以编程方式设置"隐藏推送底栏"?

Mal*_*esi 5 iphone xcode ios5

我正在从具有底部标签栏的tableview以编程方式构建视图.当选择表格单元格时,我希望此底栏消失.我可以这样做:

self.tabBarController.tabBar.hidden = YES;
Run Code Online (Sandbox Code Playgroud)

但视图的大小仍然像标签栏仍然存在.我看到如果视图是在故事板上构建的,并且通过设置复选标记"隐藏推送底栏",则视图会调整大小以占据由标签栏释放的空间.我该如何以编程方式执行此操作?

Saa*_*aad 18

self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:self.anotherViewController animated:animated];
Run Code Online (Sandbox Code Playgroud)

并为您推送的特定视图控制器.使用此代码

    TheViewController* theController = [[TheViewController alloc] initWithNibName:@"TheViewController" bundle:nil];
    theController.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:theController animated:YES];
    [theController release];
Run Code Online (Sandbox Code Playgroud)

现在,标签栏将被隐藏并以自动显示方式显示.享受时间:)