2013-01-21 32 views
1

我有這樣[Xcode中]意想不到的「@」在程序

Initialize List View Controller 
MTListViewController *listViewController = [[MTListViewController alloc] init]; 
// Initialize Navigation Controller 
UINavigationController *listNavigationController = [[UINavigationController alloc]  initWithRootViewController:listViewController]; 
// Initialize Tab Bar Controller 
UITabBarController *tabBarController = [[UITabBarController alloc] init]; 
// Configure Tab Bar Controller 
[tabBarController setViewControllers:@[listNavigationController]]; 

代碼,我在最後一行得到錯誤「在程序意外‘@’」。所以最新錯誤?我的Xcode版爲4.2

回答

2

我的Xcode版爲4.2

支持新的數組文本不可用,直到Xcode的4.4。您需要使用等效的舊語法:

[tabBarController setViewControllers:[NSArray arrayWithObject:listNavigationController]]; 
+0

thx mate now now working –