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);
}
这样不行?