Cor*_*oyd 19 iphone cocoa-touch uikit
我有以下设置:
标签栏应用.在一个选项卡上有一个导航控制器.
我的工作流程
当我将新的viewController推送到导航控制器堆栈时,我设置了hidesBottomBarWhenPushed属性.
这很好用,当新视图控制器滑动到位时,标签栏被"推".
问题:
当我弹出此视图控制器并再次显示根视图控制器时,标签栏消失了.
导航控制器已经发展到填充标签栏留下的空间.
我需要设置一个属性来使标签栏再次可见吗?
我尝试过的:
手动弹出到根视图
为根视图设置(重置)hidesBottomBarWhenPushed
调整根视图的大小
调整导航控制器的视图属性的大小(只留下标签棒应该在的"空白区域")
什么"sorta"工作:
如果我将选项卡栏控制器的选定索引设置为任何其他索引,则会显示选项卡栏.所以我知道它仍然在"周围",但这对我没什么帮助.
Dav*_*ton 112
我也有这个问题.我在错误的视图控制器上设置-hidesBottomBarWhenPushed.
错了(但似乎工作直到你弹出):
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:self.anotherViewController animated:animated];
Run Code Online (Sandbox Code Playgroud)
对:
self.anotherViewController.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:self.anotherViewController animated:animated];
Run Code Online (Sandbox Code Playgroud)
小智 9
这是我遇到的同样的问题,但我得到了一个解决方案,试试这个我发现隐藏然后在推后立即显示tabbar,解决了我们的问题
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary *theItem = [items objectAtIndex:indexPath.row];
DetailController *nextController = [[DetailController alloc] initWithItem:theItem];
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:nextController animated:YES];
//
//[nextController setHidesBottomBarWhenPushed:YES];
self.hidesBottomBarWhenPushed=NO;
[nextController release];
Run Code Online (Sandbox Code Playgroud)
}
如果您正在使用a UINavigationController并且想要在一个视图控制器中隐藏TabBar(BottomBar)的方法,请将此代码放在您想要隐藏TabBar的视图控制器中:
- (BOOL)hidesBottomBarWhenPushed {
return [self.navigationController.visibleViewController isEqual:self];
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用其他方法设置属性导致TabBar在使用隐藏的TabBar从视图控制器推送新视图控制器后隐藏(即使在将属性设置为NO后).
我在我的应用程序中做了类似的事情 - 只需调用:
[self.navigationController popToRootViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
似乎可以解决问题,标签栏又回来了 - 不可否认,这是对按钮按下的响应,而不是对导航栏弹出按钮的响应。我似乎记得使用导航栏后退按钮时效果也很好。
也许检查您只设置一个视图控制器以将 hidesBottomBarWhenPushed 属性设置为 YES。