找不到基于导航控制器的应用程序的Xcode 4新项目模板.还有其他选择

Pur*_*rva 6 navigation iphone xcode uinavigationcontroller ios5

我在iOS 5上工作.我无法找到以前在Xcode中找到的基于导航的应用程序模板.

那么我可以使用什么呢?

War*_*kst 13

如果您想从头开始,请从基于单一视图的项目开始,然后转到故事板并选择viewController,转到编辑器>嵌入>导航控制器.


ber*_*ium 8

您需要使用Master-Detail Application模板.从下拉列表中选择设备系列作为iPhone.创建项目后,您的appDelegate将包含UINavigationController实例.

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UINavigationController *navigationController;

@end
Run Code Online (Sandbox Code Playgroud)

@implementation AppDelegate

@synthesize window = _window;
@synthesize navigationController = _navigationController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.

    MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil] autorelease];
    self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    return YES;
}
Run Code Online (Sandbox Code Playgroud)