hidesBottomBarWhenPushed = NO不工作? [英] hidesBottomBarWhenPushed = NO not working?

查看:128
本文介绍了hidesBottomBarWhenPushed = NO不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用中有一个 UITabBar ,我隐藏在第一个标签中的第一个 UIViewController 将此行放在A ppDelegate 中:

I have a UITabBar in my app, which I'm hiding on the first UIViewController in the first tab by putting this line in the AppDelegate:

// ... in MyAppDelegate.m
firstViewController.hidesBottomBarWhenPushed = YES;

firstViewController 中,用户可以推送一个 UIButton ,它在同一个标​​签页中推送一个新的 UIViewController 。当发生这种情况时,我希望 UITabBar 再次可见。我试图让它像这样回来:

In the firstViewController, the user can push a UIButton that pushes a new UIViewController in the same tab. I'd like for the UITabBar to be visible again when this happens. I'm trying to make it come back like this:

//... in firstViewController.m

secondViewController = [[SecondViewController alloc] init];
secondViewController.hidesBottomBarWhenPushed = NO;
[[self navigationController] pushViewController:secondViewController animated:YES];

不幸的是,没有带回 UITabBar 。它仍然是隐藏的。

Unfortunately, does not bring back the UITabBar. It remains hidden.

如何在隐藏它之后正确地将 UITabBar 搞定?

How do I properly bring bar the UITabBar after hiding it?

提前致谢。

推荐答案

这就是文档的内容 hidesBottomBarWhenPushed 说(强调添加):

This is what the documentation for hidesBottomBarWhenPushed says (emphasis added):


如果是,则底部栏保持隐藏状态直到视图控制器从堆栈中弹出。

所以它看起来像你看到的行为正是文档所说的将会发生。首先将视图控制器推入具有 hidesBottomBarWhenPushed = YES 的堆栈。此时,将其他视图控制器推入堆栈将不会更改底栏的隐藏性。只要第一个视图控制器在堆栈中,底部栏将保持隐藏。

So it looks like the behavior you're seeing is just what the documentation says will happen. You start by pushing a view controller onto the stack which has hidesBottomBarWhenPushed = YES. At that point, pushing other view controllers onto the stack won't change the hiddenness of the bottom bar. As long as that first view controller is on the stack, the bottom bar will remain hidden.

所以我认为你必须想出一个不同的完成方式你的UI目标。一种选择是在标签栏控制器的视图上将第一个视图控制器显示为模态视图控制器。然后,当你想要转到第二个视图控制器时,只需关闭第一个视图控制器即可。唯一的视觉差异将是过渡动画。

So I think you'll have to come up with a different way of accomplishing your UI goal. One option would be to present the first view controller as a modal view controller over the tab bar controller's view. Then, when you want to go to the second view controller just dismiss the first one and voila. The only visual difference will be the transition animation.

肯定还有其他选择,但这只是我想到的第一个。

There are surely other options too, but that just came first to my mind.

祝你好运!

这篇关于hidesBottomBarWhenPushed = NO不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆