2012-05-17 35 views
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; 
} 

希望有人能幫助我

回答

1

更改以下行

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

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

是的,已經嘗試過,大聲笑只是忘記了導入它.-對不起,傢伙感謝您的幫助:) – Kevin

0

您需要更改該生產線是

self.window.rootViewController = self.viewController; 

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

這是假設你有一個名爲MenuViewController

0

創建的menuViewController對象該控制器分配給rootViewController自定義視圖控制器。

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

self.window.rootViewController = self.viewController; 
[self.window makeKeyAndVisible]; 
相關問題