2011-05-05 41 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个支持纵向和横向,但最后一个只支持纵向,你的应用程序将从不转向景观。

相关问题