我有一个完全处于纵向模式的应用程序。(iOS 5 及更高版本)我有一个使用 MPMoviePlayerController 播放的视频,现在在这个视频中,我希望当用户旋转 iPhone 时,视频应该进入横向模式(全屏)。当视频结束时,视频应该再次进入纵向模式。代码:
-(void)PlayVideo:(NSURL*)videoUrl
{
moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:videoUrl];
[moviePlayerController.view setFrame:CGRectMake(6, 69, 309, 196)];
[self.view addSubview:moviePlayerController.view];
// moviePlayerController.fullscreen = YES;
moviePlayerController.controlStyle = MPMovieControlStyleNone;
[self.view bringSubviewToFront:self.shareView];
[self.view bringSubviewToFront:self.qualityView];
[moviePlayerController play];
// Register to receive a notification when the movie has finished playing.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
}
应用程序的其余部分,我只想要纵向。我如何实现这一目标?