【问题标题】:Why can't I retrieve UIDeviceOrientation correctly while playing a movie in MPMoviePlayerController?为什么在 MPMoviePlayerController 中播放电影时无法正确检索 UIDeviceOrientation?
【发布时间】:2011-02-28 16:35:09
【问题描述】:

当我不玩任何东西时一切正常(我正在调用 beginnotifications 等,并使用方向来旋转我的视图)。但是在我开始玩MPMoviePlayerController之后,我每次尝试

UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];

orientation 得到一个 UIDeviceOrientationUnknown

有什么线索吗? 当电影停止时,一切都恢复正常。 我需要这个方向来旋转播放器的窗口,因为我使用的是 Iphone OS 3.1,所以我不能直接使用 MPMovie 播放器控制器中的 view 属性。

【问题讨论】:

    标签: iphone mpmovieplayercontroller mpmovieplayer uidevice uiinterfaceorientation


    【解决方案1】:

    至少在低于 3.2 的 iPhone OS 版本中,我还没有找到一种方法。我放弃了。

    但是,嘿,我必须在 Ipad 中为我的应用程序编写一个版本,我发现对于 iPhone OS 3.2,有办法做到这一点。

    您唯一需要做的就是使用自定义类,您必须创建MPMoviePlayerViewController 的子类并覆盖方法shouldAutorotateToInterfaceOrientation 以在您希望执行自动旋转时返回yes。这一切都在MPMoviePlayerViewController 类参考中。

    – 泽德威尔

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多