您好我有一个基于标签栏的应用程序。当我单击第三个选项卡时,打开的视图有一个 tableview ( AggregateMediaViewController
)。在 didSelect 的行中,我使用MPMoviePlayerViewController
. 每当设备的方向发生变化时,我都想设置此视频的方向。我创建了一个UITabbarController
名为的子类OrientationTabBarController
:
@implementation OrientationTabBarControllerViewController
- (BOOL)shouldAutorotate {
NSLog(@"in shouldAutorotate tabbar is %@", self.viewControllers);
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
在appDidFifnishLaunching: [window setRootViewController:tabBarController]; 其中 tabBarController 是 OrientationTabBarController 的子类。
在 AggregateMediaViewController 中,我有以下代码:
- (BOOL)shouldAutorotate
{
NSLog(@"in shouldAutorotate of media");
return YES;
}
-(NSInteger)supportedInterfaceOrientations {
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
但是当我运行应用程序时,方向不起作用:(请帮助