首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

UITabBarController的orientation有关问题

2012-03-29 
UITabBarController的orientation问题。MyCardInfoController *myCardInfoController [[MyCardInfoContro

UITabBarController的orientation问题。
MyCardInfoController *myCardInfoController = [[MyCardInfoController alloc] init];
UINavigationController *nav2 = [[SCUINavigationController alloc] initWithRootViewController:myCardInfoController];
[controllers addObject:nav2];

UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = controllers;
我自己在某个事件响应方法中,自己构造UITabBarController,其元素为UINavigationController,而它的根为我的自定义UIViewController,运行时一直报这个错误:

The view controller <UITabBarController: 0x3949c00> returned NO from _shouldAutorotateToInterfaceOrientation: for all interface orientations. It should support at least one orientation.

对我自定义的UIViewController的- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return NO;
}
作了各种尝试,均没有效果,请达人帮忙看看,谢谢。

[解决办法]
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

这样不行?

热点排行