隐藏导航栏 [英] Hide navigation bar

查看:107
本文介绍了隐藏导航栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个观看次数。 (比如说第1,第2,第3)。我已经在第一个推动了第二个视图(有一个加载视图方法)。在第二个视图中,我使用 initWithFrame (它继承自UIWebView)创建了第三个视图。在第二个视图中,我写了self.view = 3rd view。

I have 3 views. (say 1st,2nd,3rd). I have pushed the 2nd view (which has a load view method) on the 1st. In the 2nd view I have created the 3rd using initWithFrame (which is inherited from UIWebView). In 2nd view I wrote self.view=3rd view.

现在我想在第三个视图中隐藏第二个视图的导航栏(即,当用户触摸第三个视图屏幕,即UIWebView时)。我使用手势获得了触摸识别,但我无法隐藏导航栏。

Now I want to hide the 2nd view's navigation bar in the 3rd view (i.e., when the user touch to 3rd view screen i.e. UIWebView). I got the touch recognition using gesture, but I can't hide the navigation bar.

第3个视图不支持 self.navigationController 。如果我在3rd中创建第二个视图的对象,它不会隐藏导航栏。有人可以帮帮我吗?

3rd view don't support self.navigationController. And if I create 2nd view's object in 3rd, it does not hide the navigation bar. Can anybody help me?

推荐答案

好的。因此,您需要在为该选项卡创建导航控制器后立即隐藏导航栏。按下视图控制器后,您无法调整此值(据我所知)。

Ok. So you need to set the navigation bar to be hidden right after you create the navigation controller for that tab. You cannot adjust this after you push the view controller (as far as I know).

如果您希望第一个视图顶部没有导航栏,请在最初声明导航控制器的appDelegate中使用它:

If you want the first view to not have a navigation bar at the top, then use this in your appDelegate where you initially declare your navigation controllers:

localNavigationController = [[UINavigationController alloc] initWithRootViewController:theViewController];
[localNavigationController setNavigationBarHidden:YES animated:YES];

如果你想隐藏那之后的视图,那么你需要一个viewController用于后续的视图,你必须添加

If you want the views after that to be hidden, then you need a viewController for the subsequent views, and you will have to add

[[self navigationController] setNavigationBarHidden:YES animated:YES];

在您致电之前:

[[self navigationController] pushViewController:theThirdViewController animated:YES];

希望这会有所帮助。

这篇关于隐藏导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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