hidesBottomBarWhenPushed但弹出时

hidesBottomBarWhenPushed但弹出时

本文介绍了hidesBottomBarWhenPushed但弹出时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,似乎很简单。
我的应用程序有一个视图层次结构,包含一个UITabBarController包含UINavigationControllers。当我从根导航到第二级
我设置hidesBottomBarWhenPushed为true,以便标签栏隐藏



在我的firstLevelController:

  [secondLevelController setHidesBottomBarWhenPushed:YES]; 

[self.navigationController pushViewController:secondLevelController animated:YES];

之后,当我推到第三级时,我再次通过在secondLevelController :

  [self setHidesBottomBarWhenPushed:NO]; 

[thirdLevelController setHidesBottomBarWhenPushed:NO];

[self.navigationController pushViewController:thirdLevelController animated:YES];

(我知道,我不喜欢 [self setHidesBottomBarWhenPushed:NO ] ,但它没有工作否则...)



所以,这里是问题:





<$>

解决方案

p $ p> [self setHidesBottomBarWhenPushed:NO];
[thirdLevelController setHidesBottomBarWhenPushed:NO];
[self.navigationController pushViewController:thirdLevelController animated:YES];
[self setHidesBottomBarWhenPushed:YES];

thirdlevelController显示tabbar,而secondLevelController在弹出thirdLevelController时不显示tabbar。


I've a problem with something that seems to be very simple.My app has a view hierarchy consisting in a UITabBarController containing UINavigationControllers. When I navigate from the root to the second levelI set the hidesBottomBarWhenPushed on true so that the tab bar is hidden

On my firstLevelController:

[secondLevelController setHidesBottomBarWhenPushed:YES];

[self.navigationController pushViewController:secondLevelController animated:YES];

After that when I push to the third level, I bring the tab bar again by doing in the secondLevelController:

[self setHidesBottomBarWhenPushed:NO];

[thirdLevelController setHidesBottomBarWhenPushed:NO];

[self.navigationController pushViewController:thirdLevelController animated:YES];

(I know, I didn't like the [self setHidesBottomBarWhenPushed:NO] either, but it didn´t work otherwise...)

So, here is the problem: when I push the back button in the third level and the second view appears, I need to hide the tabbar again but I couldn´t find the way of doing this.

Any help is appreciated

解决方案

This is what works for me.

[self setHidesBottomBarWhenPushed:NO];
[thirdLevelController setHidesBottomBarWhenPushed:NO];
[self.navigationController pushViewController:thirdLevelController animated:YES];
[self setHidesBottomBarWhenPushed:YES];

The thirdlevelController shows the tabbar and secondLevelController does not show the tabbar when you pop the thirdLevelController.

这篇关于hidesBottomBarWhenPushed但弹出时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 11:35