首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >UIInterfaceOrientation问题

UIInterfaceOrientation问题
EN

Stack Overflow用户
提问于 2011-05-05 06:58:12
回答 1查看 1.7K关注 0票数 0

我的程序不支持UIInterfaceOrientation。程序将不支持UIInterfaceOrientation后,我添加UITabBarItem.Please给出一个解决方案。此外,我还添加了navigationController。这是我的密码。

代码语言:javascript
运行
复制
-(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];
firstViewController.navigationItem.title=@"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];
}
EN

回答 1

Stack Overflow用户

发布于 2011-05-05 07:36:13

如果您有UITabBarController,all选项卡应该支持您的接口方向。因此,如果您有3个选项卡,其中2个支持纵向和横向,但最后一个只支持纵向,您的应用程序将永远不会转向景观。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5893812

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档