不明白如何在 iPhone 中使用导航控制器
我对 iPhone 非常陌生,我有以下误解。
在互联网上,有关如何以编程方式使用 NavigationController
的教程都说:
NavigationController must be declared in applicationDidFinishLaunching and must be init with a root.After that you can add views to it.
我有这个: UIViewController
类意味着(AdiViewController.h、AdiViewController.m 和 AdiViewController.xib)
,并且没有 Delegate 文件
意味着没有 applicationDidFinishLaunching
代码>方法。
我想要做的是当按下按钮转到另一个视图时,从我的类 AdiViewController
中进行操作。 我知道我需要一个 NavigationController
,它应该保留我的具有根 AdiViewController
的视图。
但我的问题是我应该在 viewDidAppear
中的哪里初始化 NavigationController
??...因为我没有 Delegate
文件。
如果你能为我的这个小问题提供一个最小的例子,那就太好了。我确信对于那些高级的人来说这没什么,但我仍然不明白。谢谢
I'm extremly new to iphone and I have the following misunderstanding.
All over internet the tutorials about how to use NavigationController
programatically it says:
NavigationController must be declared in applicationDidFinishLaunching and must be init with a root.After that you can add views to it.
I have this:
A UIViewController
class meaning(AdiViewController.h, AdiViewController.m and AdiViewController.xib)
and no Delegate file
meaning no applicationDidFinishLaunching
method.
What I wanna do is from my class-AdiViewController
when pressing a button to go to another view.
I understand that I need a NavigationController
which should retain my views having the root AdiViewController
.
But my problem is where should I initializate that NavigationController
in viewDidAppear
??...cause I don't have the Delegate
files.
If you could provide a minimal example with this small issue of mine it would be great.I'm sure that for those how are senior this is nothing but still I don't get it.Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NavigationController 必须在 applicationDidFinishLaunching -> 中声明这不是真的。
在你的 AdiViewController 中,如果你有按钮,当你按下该按钮时,你想加载导航控制器,对吗?
如果您在 AnotherViewController 中,即您位于导航控制器的根视图控制器中。您需要从那里推送和弹出视图控制器。例如,如果您在 AnotherViewController 中有一个按钮:
NavigationController must be declared in applicationDidFinishLaunching -> this is not true.
In your AdiViewController if you have button when you push that button you want to load navigation Controller right ?
If you are in AnotherViewController i.e., you are in root view controller of Navigation controller. You need to push and pop view controllers from there. For example if you have a button in AnotherViewController: