MPMoviePlayerController 完成按钮,横向
我正在使用简单的 MPMoviePlayerController。在纵向模式下,它嵌入到我的布局中。当我旋转设备时,我希望它全屏显示。在全屏模式下,有一个完成按钮,但它唯一的作用就是暂停视频。我想在点击完成按钮时关闭模态视图控制器。我该怎么做?
我尝试过:
将 [UIColor clearColor] 放在按钮的背景上,并将按钮放在“完成”按钮上,从而将触摸事件拦截到我自己的选择器中。它失败了,因为当 MPMoviePlayerController 处于全屏模式时,我的自定义按钮不会显示。
转到通知中心并尝试捕获“willExitFullscreen”,但它不会发生(在横向全屏模式下按完成按钮不会退出全屏模式)。
在 MPMoviePlayerController 中查找“完成”按钮...但我找不到它。
使用 MPMoviePlayerViewController 不是一个选项,因为我希望能够在纵向模式下在控制器中使用嵌入式播放器,并且能够旋转影片而无需从头开始加载(因此,当用户更改设备方向时推送新控制器是不正确的)对我来说的解决方案)。
我已经阅读了有关此问题的一些主题,问题可以相同或相似,但 anserws 需要我已检查的内容(即通知)或我无法使用的内容(MPMoviePlayerViewController)。
回答(因为我无法在 7 小时内发布) 呵呵,好吧..
这整个混乱的罪魁祸首是这行代码
[self.mpPlayer setControlStyle:MPMovieControlStyleFullscreen];
所以似乎在进入全屏模式时设置全屏控制样式会破坏完成按钮....
对我来说毫无意义。但是当我注释掉这一行时,我能够收到 willExitFullscreen 通知,并且我可以使用它。
I'm using simple MPMoviePlayerController. In portrait mode it is emmbedded into my layout. When I rotate my device I want it to go full screen. In full screen mode there is a done button but only thing it does is pausing the video. I want to dismiss modal view controller when the done button is tapped. How can I do this?
I've tried:
Putting a [UIColor clearColor] on a background of a button and place a button over Done button thus intercept touch event into my own selector. It failed because my custom button isn't displayed when MPMoviePlayerController is in fullscreen mode.
Going to notification center and trying to catch "willExitFullscreen" but it won't occur (pressing done button when in landscape fullscreen mode isn't goint out from the fullscreen mode).
Finding done button in the MPMoviePlayerController... but I was unable to find it.
Using MPMoviePlayerViewController isn't an option as I want to be able to use embedded player in my controller when i Portrait mode, and be able to rotate movie without loading it from scratch (so pushing new controller when user changes device orientation isn't right solution for me).
I've read a few topics on this issue and question can be the same or similar but anserws require either things I've checked (i.e. notifications) or things I can't use (MPMoviePlayerViewController).
ANSWER (as I am unable to post it in 7h)
Heh ok..
The culprit of this whole mess was this line of code
[self.mpPlayer setControlStyle:MPMovieControlStyleFullscreen];
So it seems that setting Fullscreen control style when going into fullscreen mode will break done button....
Makes no sense to me. But when I commented out this line I am able to recive willExitFullscreen notification and I can work with that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
整个混乱的罪魁祸首是这行代码
所以似乎在进入全屏模式时设置全屏控制样式会破坏完成按钮......
对我来说没有意义。但是当我注释掉这一行时,我能够收到 willExitFullscreen 通知,并且我可以使用它。
The culprit of this whole mess was this line of code
So it seems that setting Fullscreen control style when going into fullscreen mode will break done button....
Makes no sense to me. But when I commented out this line I am able to recive willExitFullscreen notification and I can work with that.