Iphone UINavigationController不工作

Iphone UINavigationController不工作,iphone,objective-c,ipad,animation,uinavigationcontroller,Iphone,Objective C,Ipad,Animation,Uinavigationcontroller,我正在尝试获取使用UINavigationController生成的幻灯片动画 所有的UINavigationController设置示例都涉及对不同的视图使用多个XIB,但是我所有的视图都是UIViewControllers在一个XIB中 到目前为止,我使用的是[self-presentModalViewController:myViewController-animated:YES],它工作得非常好 所有“我的视图”控制器都通过IBOutlets连接到主XIB 例如: #import "My

我正在尝试获取使用
UINavigationController
生成的幻灯片动画

所有的
UINavigationController
设置示例都涉及对不同的视图使用多个
XIB
,但是我所有的视图都是
UIViewControllers
在一个
XIB

到目前为止,我使用的是
[self-presentModalViewController:myViewController-animated:YES],它工作得非常好

所有“我的视图”控制器都通过
IBOutlets
连接到主
XIB

例如:

#import "MyViewController.h"

@interface ViewController : UIViewController {
...
IBOutlet MyViewController *myViewController;
//connected through Interface Builder
...
}
界面生成器中

我想我可以用这样的东西:

UINavigationController *myNavController = [[[UINavigationController alloc] initWithRootViewController:self] autorelease];
[myNavController pushViewController:myViewController animated:YES]; 
然而,这绝对没有任何作用

我有点被这件事缠住了


非常感谢您的帮助。

您必须在某个位置将
UINavigationController
的视图添加到视图层次结构中。 在基于Xcode模板导航的应用程序中,通过将其添加到
ui窗口

[window addSubview:navigationController.view];

您必须在某个位置将
UINavigationController
的视图添加到视图层次结构中。 在基于Xcode模板导航的应用程序中,通过将其添加到
ui窗口

[window addSubview:navigationController.view];

我看了文档后破解了它

我在我的应用程序的
中创建了一个
UINavigationController
,使用选项完成启动:
方法如下:

UIViewController *dcview = [[DocumentationViewController alloc] init];
navigationController = [[UINavigationController alloc]
                        initWithRootViewController:dcview];
[dcview release];
navigationController.navigationBarHidden = YES;
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[window addSubview:navigationController.view];
[window makeKeyAndVisible];
然后打电话

[((DocumentationAppDelegate *)[UIApplication sharedApplication].delegate).navigationController pushViewController:settingsView animated:YES];

推动它。

我在查看文档后破解了它

我在我的应用程序的
中创建了一个
UINavigationController
,使用选项完成启动:
方法如下:

UIViewController *dcview = [[DocumentationViewController alloc] init];
navigationController = [[UINavigationController alloc]
                        initWithRootViewController:dcview];
[dcview release];
navigationController.navigationBarHidden = YES;
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[window addSubview:navigationController.view];
[window makeKeyAndVisible];
然后打电话

[((DocumentationAppDelegate *)[UIApplication sharedApplication].delegate).navigationController pushViewController:settingsView animated:YES];

要推动它。

我们需要看到更多的代码-例如,“myViewController”在哪里实例化?我们需要看到更多的代码-myViewController在哪里例如,实例化?是在AppDelegate中创建的UIWindow吗?是在加载第一个NIB时创建的AppDelegate的出口。好的,当我按下按钮时,我将加载一个空白视图-向后推不会返回到上一个控制器,而是返回到一个白色屏幕。NaivationController是的rootViewController吗窗口?是在AppDelegate中创建的UIWindow吗?它是在加载第一个NIB时创建的AppDelegate的出口。好的,当我按下按钮时,我得到一个要加载的空白视图-向后推不会返回到上一个控制器,而是返回到一个白色屏幕。NaivationController是窗口的rootViewController吗?