找不到基于导航控制器的应用程序的 Xcode 4 新项目模板.有什么选择吗? [英] Cannot find Xcode 4 new project template for navigation controller based app. Any alternative?

查看:8
本文介绍了找不到基于导航控制器的应用程序的 Xcode 4 新项目模板.有什么选择吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am working on iOS 5. I am not able to find the navigation based application template formerly found in Xcode.

那我可以用什么代替呢?

So what can I use instead?

推荐答案

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

You need to use Master-Detail Application template. Choose Device Family from dropdown list as iPhone. After creating a project your appDelegate will contain UINavigationController instance.

@interface AppDelegate : UIResponder <UIApplicationDelegate>

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

@end

@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;
}

这篇关于找不到基于导航控制器的应用程序的 Xcode 4 新项目模板.有什么选择吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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