2012-12-12 48 views
0

我正在製作一個應用程序,將導航控制器嵌入到tabbarcontroller中。現在,當我打開應用程序,我只是一個空白的黑屏。應用程序打開空白黑屏

這裏是我的代碼

PDCFirstViewController *viewController1 = [[PDCFirstViewController alloc] 
initWithNibName:@"PDCFirstViewController" bundle:nil]; 

PDCSecondViewController *viewController2 = [[PDCSecondViewController alloc] 
initWithNibName:@"PDCSecondViewController" bundle:nil]; 

ViewController *viewController3 = [[ViewController alloc] 
initWithNibName:@"ViewController" bundle:nil]; 
UINavigationController *navigationcontroller = [[UINavigationController alloc] 
initWithRootViewController:viewController3]; 

self.tabBarController = [[UITabBarController alloc] init]; 
self.tabBarController.viewControllers = [NSArray 
arrayWithObjects:viewController1,viewController2,navigationcontroller, nil]; 

[self.window makeKeyAndVisible]; 

我需要補充一下或做一些不同,以使應用程序的顯示?任何援助將是偉大的!謝謝!

+1

self.window.rootViewController = self.tabBarControlle R等 –

+0

您應該在啓動時收到警告,提示解決方案。 – jrturton

+1

@Anusha你是對的。 – Girish

回答

1

你缺少rootviewcontroller

添加此

self.window.rootViewController = self.tabBarController; 

希望它可以幫助你..

0
self.window.rootViewController = self.tabBarController; 

應該這樣做

+0

需要self.tabBarController,上面的代碼中沒有ivar。 – jrturton

+0

@jrturton對,編輯。 – MCKapur

0
self.window.rootViewController = self.tabBarController;