iPhone SDK:如何添加第二个UINavigationController? [英] iPhone Sdk: How to add a second UINavigationController?

查看:58
本文介绍了iPhone SDK:如何添加第二个UINavigationController?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用apple给定的基于导航的模板创建了一个应用程序.现在,我想向我的应用程序添加第二个导航控制器,包括一个新的UITableView.有人可以告诉我该怎么做吗?谢谢!

i created an app from the navigation-based template given by apple. Now i want to add a second navigation controller to my application including a new UITableView. Can anybody show my how to do this? Thanks!

推荐答案

我认为可以做到.在您的应用程序委托中,您通常会执行以下操作 [window addSubview:navController.view]. UIWindow只是一个UIView.因此,如果您在UIViewController中创建两个UIView ivars,它们将包含两个导航控制器,则您应该能够执行类似的操作:

I think this can be done. In your app delegate you normally do something like [window addSubview:navController.view]. UIWindow is just a UIView. So if you create two UIView ivars in the UIViewController that will contain the two nav controllers you should be able to do a similar thing:

@interface MyViewController : UIViewController
{
  UIView* upperView;
  UIView* lowerView;
}

等...

MyUpperRootViewController* myUpperRVC = [[MyUpperRootViewController alloc] init...
UINavigationController* myUpperNavController = [[UINavigationController alloc] initWithRootViewController:myUpperRVC];
[upperView addSubview:navController.view];
[myUpperRVC release];

以及lowerView上的类似内容.

在推入控制器的根视图或子序列视图中,以通常的方式访问它们,就像有一个导航控制器一样. [self.navigationController push...应该表现正常.

In the root view or subseqeunt views pushed onto the controllers access them in the usual way as if there was one nav controller. [self.navigationController push... should behave normally.

要使视图控制器动画化(或动画出),只需将动画应用于视图-upperView或lowerView.您可能要先从可见显示的帧开始,然后将其更改为动画块内可见的帧.

For animating in (and out) the view controllers, just apply the animation to the views - upperView or lowerView. You might want to start with their frames off the visible display and then change them to something visible inside an animation block.

这篇关于iPhone SDK:如何添加第二个UINavigationController?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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