如何:标签栏控制器中的导航控制器

时间:2023-01-30 17:27:13

I'm woking on a simple iphone application. The applicaton has a table view on first screen. If the user clicks on an item on that table view, application navigates to the second view. The second view has a table view, too. If the user clicks on an item on this screen, I want to show a new xib which has Tab Bar Controller.

我正在使用简单的iphone应用程序。该应用程序在第一个屏幕上有一个表格视图。如果用户单击该表视图上的项目,则应用程序将导航到第二个视图。第二个视图也有一个表格视图。如果用户点击此屏幕上的某个项目,我想显示一个带有标签栏控制器的新xib。

Actually, I did it. But, the problem is that I can't see the tabs. The tabs are shown at the bottom, outside of the screen. How can I solve this problem?

实际上,我做到了。但是,问题是我看不到标签。标签显示在屏幕外部的底部。我怎么解决这个问题?

Thanks.

谢谢。

3 个解决方案

#1


15  

Here is an tutorial that I was able to get working.

这是一个我能够工作的教程。

I also read the official SDK documentation on the topic: Combining Tab Bar and Navigation Controllers. Since I'm still learning, the tutorial helped me more than the docs.

我还阅读了有关主题的官方SDK文档:组合标签栏和导航控制器。由于我还在学习,这个教程比文档更能帮助我。

NOTE: in the tutorial, i don't think you need to subclass UINavigationController, and I'm experimenting with this idea now.

注意:在教程中,我认为你不需要继承UINavigationController,我现在正在尝试这个想法。

UPDATE: I was able to get the tutorial working without subclassing UINavigationController. So a subclass is not required.

更新:我能够在没有子类化UINavigationController的情况下使教程工作。因此不需要子类。

#2


1  

Open Interface Builder.

打开Interface Builder。

Click a tab and check whether sub-controller(of tabbar controller) is UIViewController or UINavigationController. (Default: UIViewController)

单击选项卡,检查子控制器(tabbar控制器)是否为UIViewController或UINavigationController。 (默认值:UIViewController)

If UIViewController, replace it with UINavagationController.

如果是UIViewController,请将其替换为UINavagationController。

And Set the root view controller of UINavigationController to first view controller.

并将UINavigationController的根视图控制器设置为第一个视图控制器。

Last, call pushViewController method, not presentModalViewController method.

最后,调用pushViewController方法,而不是presentModalViewController方法。

#3


-1  

TabBar HAS to be the root controller, add navControllers in the tab items as needed and hide the tabBar at the beginning of the App, to show it when you want it to appear.

TabBar必须是根控制器,根据需要在选项卡项中添加navControllers并隐藏应用程序开头的tabBar,以便在需要时显示它。

#1


15  

Here is an tutorial that I was able to get working.

这是一个我能够工作的教程。

I also read the official SDK documentation on the topic: Combining Tab Bar and Navigation Controllers. Since I'm still learning, the tutorial helped me more than the docs.

我还阅读了有关主题的官方SDK文档:组合标签栏和导航控制器。由于我还在学习,这个教程比文档更能帮助我。

NOTE: in the tutorial, i don't think you need to subclass UINavigationController, and I'm experimenting with this idea now.

注意:在教程中,我认为你不需要继承UINavigationController,我现在正在尝试这个想法。

UPDATE: I was able to get the tutorial working without subclassing UINavigationController. So a subclass is not required.

更新:我能够在没有子类化UINavigationController的情况下使教程工作。因此不需要子类。

#2


1  

Open Interface Builder.

打开Interface Builder。

Click a tab and check whether sub-controller(of tabbar controller) is UIViewController or UINavigationController. (Default: UIViewController)

单击选项卡,检查子控制器(tabbar控制器)是否为UIViewController或UINavigationController。 (默认值:UIViewController)

If UIViewController, replace it with UINavagationController.

如果是UIViewController,请将其替换为UINavagationController。

And Set the root view controller of UINavigationController to first view controller.

并将UINavigationController的根视图控制器设置为第一个视图控制器。

Last, call pushViewController method, not presentModalViewController method.

最后,调用pushViewController方法,而不是presentModalViewController方法。

#3


-1  

TabBar HAS to be the root controller, add navControllers in the tab items as needed and hide the tabBar at the beginning of the App, to show it when you want it to appear.

TabBar必须是根控制器,根据需要在选项卡项中添加navControllers并隐藏应用程序开头的tabBar,以便在需要时显示它。