0

我在 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;
}

希望有人可以帮助我

4

3 回答 3

1

更改以下行

self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];

self.viewController = [[[menuViewController alloc] initWithNibName:@"menuViewController" bundle:nil] autorelease];
于 2012-05-17T14:31:54.043 回答
0

您需要更改的行是

self.window.rootViewController = self.viewController;

MenuViewController *menuViewController = [[[MenuViewController alloc] init] autorelease];
self.window.rootViewController = menuViewController;   

这是假设您有一个名为 MenuViewController 的自定义视图控制器

于 2012-05-17T14:34:42.760 回答
0

创建menuViewController将此控制器分配给的对象rootViewController

self.viewController = [[[MenuViewController alloc] initWithNibName:@"menuViewController" bundle:nil] autorelease];  

self.window.rootViewController = self.viewController; 
[self.window makeKeyAndVisible]; 
于 2012-05-17T14:34:46.353 回答