iphone - 我的 iPhone 视频只能以纵向模式播放

标签 iphone ios ios4 mpmovieplayercontroller

我正在使用 MPMoviePlayerController 播放电影。电影以纵向模式开始(因为这是该应用程序使用的唯一模式)并且即使设备旋转也保持在那里。我从未明确设置 shouldAutoRotateetc。响应横向和纵向的功能,因为我不想调整我的 View 大小。有没有办法让视频响应纵向和横向旋转?任何帮助将不胜感激。

仅供引用:这是我的代码

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];

最佳答案

嗯。好的。在我被难住后半小时想通了。

现在显然有一个 MPMoviePlayerViewController 可以处理所有这些。这是我新更新的代码:

    MPMoviePlayerViewController *moviePlayerView = [[[MPMoviePlayerViewController alloc] initWithContentURL:videoURL] autorelease];
[self presentMoviePlayerViewControllerAnimated:moviePlayerView];

这将允许它响应旋转事件等。很好!

关于iphone - 我的 iPhone 视频只能以纵向模式播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4911074/

相关文章:

iOS Facebook SDK 登录 View 有时会显示桌面 Web 而不是移动 Web

ios - UIFont fontWithSize:更改fontName

ios - NSURLConnection 返回多个 php session ID

ios - UITableView 一次只勾选一行

iphone - 在 Textview 中共享数据并维护数据状态不起作用

iphone - 智能手机的媒体查询(横向)

ios - GradientLayer 不水平填充 UIButton 边界

iphone - Facebook 设置 iOS 6 - 应用程序名称未显示在允许应用程序列表中

iphone - iOS adhoc wifi 传感器数据

iphone - UIDatePicker:时间模式:初始化时间(一定要简单)