2011-05-05 38 views
0

我的程序不支持UIInterfaceOrientation。在添加UITabBarItem之後,程序將不支持UIInterfaceOrientation。請提供解決方案。另外我添加了navigationController。 這是我的代碼。UIInterfaceOrientation問題

-(void) applicationDidFinishLaunching:(UIApplication *)application { 
//I create my navigation Controller 
    //UINavigationController *navigationController; 
    //I create my TabBar controlelr 
    tabBarController = [[UITabBarController alloc] init]; 
    // Icreate the array that will contain all the View controlelr 
    NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:2]; 
    // I create the view controller attached to the first item in the TabBar 

sivajitvViewController *firstViewController; 
firstViewController = [[sivajitvViewController alloc]init]; 
navigationController = [[UINavigationController alloc] initWithRootViewController:firstViewController]; 
//[navigationController.tabBarItem initWithTabBarSystemItem:UITabBarSystemItemFavorites tag:1]; 
[email protected]"Gallery"; 
//viewController.tabBarItem.image = [UIImage imageNamed:@"natural.jpg"]; 
navigationController.tabBarItem.image = [UIImage imageNamed:@"Gallery.png"]; 
navigationController.tabBarItem.title = @"Gallery"; 
//navigationController.headerTitle = @"Some Title"; 


[localControllersArray addObject:navigationController]; 
[navigationController release]; 
[firstViewController release]; 

// I create the view controller attached to the second item in the TabBar 

SecondViewController *secondViewController; 
secondViewController = [[SecondViewController alloc] init]; 
navigationController = [[UINavigationController alloc] initWithRootViewController:secondViewController]; 
//[navigationController.tabBarItem initWithTabBarSystemItem:UITabBarSystemItemContacts tag:2]; 
navigationController.tabBarItem.image = [UIImage imageNamed:@"News.png"]; 
navigationController.tabBarItem.title = @"News"; 


[localControllersArray addObject:navigationController]; 
[navigationController release]; 
[secondViewController release]; 

// load up our tab bar controller with the view controllers 
tabBarController.viewControllers = localControllersArray; 

// release the array because the tab bar controller now has it 
[localControllersArray release]; 

// add the tabBarController as a subview in the window 
[window addSubview:tabBarController.view]; 

// need this last line to display the window (and tab bar controller) 
[window makeKeyAndVisible]; 
} 
+0

哪個UIInterfaceOrientation不支持你的應用程序? – 2011-05-05 06:59:50

+0

問題不清楚。請給出更具體的細節。 – Aaron 2011-05-05 07:04:30

回答

2

如果你的UITabBarController,所有標籤應該支持你的接口方向。所以如果你有3個標籤,其中2個支持縱向和橫向,但最後一個只支持縱向,你的應用程序將從不轉向景觀。

相關問題