可能是从Xcode4之后,苹果就取消了创建Navigation View app,使用Single View App来代替了。当我们需要使用Navigation View app的时候,需要在Single View App中手动修改一些代码,下面是修改的步骤:
1.创建一个Single View App工程
2.新建XNavigationController类,继承自UINavigationController
3.把XAppDelegate.h的头文件中的XViewController改成XNavigationController
4.在XAppDelegate.m文件中的didFinishLaunchingWithOptions做如下修改,创建了一个以viewRootViewController为根视图。
XViewController *viewRootViewController = [[[XViewController alloc] initWithNibName:@"XViewController" bundle:nil] autorelease];
self.navigationController = [[[XNavigationController alloc] initWithRootViewController:viewRootViewController] autorelease];
self.window.rootViewController = self.navigationController;