导航控制器(iPhone)的后退按钮问题 [英] Back Button Issues With Navigation Controller (iPhone)

查看:139
本文介绍了导航控制器(iPhone)的后退按钮问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这里是我正在寻找的功能:

1.主菜单没有导航栏barework
2.主菜单中的所有其他屏幕do。
3.它应该能够正确地生成动画。

So here's the functionality that I'm looking for:
1. Main Menu doesn't have the navigation Bar
2. All other screens from the Main Menu do.
3. It should animate correctly

我有一部分工作(不是后面的按钮部分)。

I partially got this to work (just not the back button part).

在主菜单viewDidLoad我只是:

In the Main Menu viewDidLoad I just go:

[self.navigationController setNavigationBarHidden:YES];

在另一个窗口(Screen1)中,在viewDidLoad中:

In another window (Screen1), in its viewDidLoad I go:

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

现在,当我运行程序。我在主菜单中有我自己的按钮,当您单击它,它转换到Screen1,动画正常工作:即,主菜单中没有酒吧,但一旦我点击按钮,Screen1幻灯片与其导航控制器酒吧。到现在为止还挺好。

So now, when I run the program. I have my own button in the main menu that when you click it, it transitions to Screen1, and the animation works properly: I.e., no bar in main menu but and as soon as I hit the button, Screen1 slides in with its Navigation Controller Bar. So far so good.

但这里的问题,当我点击返回按钮从屏幕1回到我的主菜单,它保持导航控制器栏在那里(即,它不't调用主菜单的viewDidLoad),但我不想在我的主菜单中的一个酒吧!任何想法?

But here's the problem, when I click the "back" button to go back to my Main Menu from Screen1 it keeps the Navigation Controller Bar up there (i.e., it doesn't call the Main Menu's viewDidLoad) but I don't want a Bar in my main menu! Any ideas?

推荐答案

不要使用 viewDidLoad c $ c> viewWillAppear:或 viewDidAppear:(取决于哪种更适合你)。 viewDidLoad 仅在第一次加载视图时调用一次。

Don't use viewDidLoad, use viewWillAppear: or viewDidAppear: (depending on which looks better for you). viewDidLoad is only called once, the first time the view loads.

这篇关于导航控制器(iPhone)的后退按钮问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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