问题描述
如何使用导航控制器中的按钮推送视图?我试着按照这个例子:http://www.cimgf.com/2009/06/25/uitabbarcontroller-with-uinavigationcontroller-using-interface-builder/
How to push a view using a button in a navigation controller? I tried to follow this example: http://www.cimgf.com/2009/06/25/uitabbarcontroller-with-uinavigationcontroller-using-interface-builder/
这正是我需要的,我有一个带有 4 个选项卡的 UITabBarController
,其中一个是 UINavigationController
.我想从第一个视图推送包含导航控制器的视图 - 这是一个简单的 UIView
.它不起作用,我也尝试使用以编程方式创建的按钮,但没有任何反应.有什么指点吗?
This is exactly what I need, I have an UITabBarController
with 4 tabs and one of them is an UINavigationController
. I want to push that view containing the navigation controller from the first view- which is a simple UIView
. It doesn't work, I tried also with a programmatically created button and nothing happens. Any pointers?
这是我的代码
这也是连接的屏幕截图http://imageshack.us/photo/my-images/847/screenshot20110719at620.png/
我已经尝试了你们的建议,但仍然没有,按钮(无论是在 Interface Builder
中创建还是以编程方式创建)就像它们没有链接到任何方法一样.
I've tried what you guys suggested and still nothing, the buttons( whether they are created in Interface Builder
or programmatically ) act like they're not linked to any method.
推荐答案
把这个放在你想创建按钮的地方:(例如Root VC的-viewDidLoad
)
Put this where you want to create the button: (e.g. the Root VC's -viewDidLoad
)
并实现这个方法:
这篇关于在 UINavigationController 中推送另一个视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!