我在didFinishLaunching上获得了这段代码,但我不知道如何自定义它以便在我打开应用程序时打开menuViewController。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
// At the end of applicationDidFinishLaunching, right before
// the return YES
[[GCTurnBasedMatchHelper sharedInstance] authenticateLocalUser];
return YES;
}
希望有人可以帮助我
答案 0 :(得分:1)
更改以下行
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
到
self.viewController = [[[menuViewController alloc] initWithNibName:@"menuViewController" bundle:nil] autorelease];
答案 1 :(得分:0)
您需要更改的行是
self.window.rootViewController = self.viewController;
到
MenuViewController *menuViewController = [[[MenuViewController alloc] init] autorelease];
self.window.rootViewController = menuViewController;
假设您有一个名为MenuViewController的自定义视图控制器
答案 2 :(得分:0)
创建menuViewController
的对象,将此控制器分配给rootViewController
。
self.viewController = [[[MenuViewController alloc] initWithNibName:@"menuViewController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];