我是这样做的:
在项目文件中,确保您支持横向方向

现在在所有仍应为纵向的 ViewControllers 中,添加此代码
//ios6
- (BOOL)shouldAutorotate {
return NO;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
//ios4 and ios5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
我已经同时调用了 iOS5 和 iOS6,以便我的代码可以在两者上运行。
当您的 MPMoviePlayerController 视图变为全屏时,它将是一个新的 ViewController,位于其他所有视图之上。因此,将允许根据项目支持的界面方向旋转。它不会看到你在哪里强制其他 ViewControllers 进入 Portrait。