我正在使用MPMoviePlayerController播放电影。电影以纵向模式启动(因为这是应用程序使用的唯一模式),即使设备已旋转,也会停留在那里。我从未明确设置shouldAutoRotateetc。功能,以响应横向和肖像,因为我不希望我的意见调整大小。有没有办法让视频响应纵向和横向旋转?任何帮助将不胜感激。
仅供参考:这是我的代码
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"TestMovie" ofType:@"m4v"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
//Listen so we can clean up after the movie is over
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlaybackComplete:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController];
[self.view addSubview:moviePlayerController.view];
[moviePlayerController setFullscreen:YES animated:YES];
[moviePlayerController play];
答案 0 :(得分:1)
嗯。好。在我被难倒后半小时计算出来。
现在显然有一个处理所有这些的MPMoviePlayerViewController。这是我新的更新代码:
MPMoviePlayerViewController *moviePlayerView = [[[MPMoviePlayerViewController alloc] initWithContentURL:videoURL] autorelease];
[self presentMoviePlayerViewControllerAnimated:moviePlayerView];
这将允许它响应旋转事件等。很好!