如何在iPad上以全屏模式捕捉MPMoviePlayer下一次按钮点击事件? [英] How do I catch the MPMoviePlayer next button click event while in fullscreen mode on the iPad?

查看:117
本文介绍了如何在iPad上以全屏模式捕捉MPMoviePlayer下一次按钮点击事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当iPad上的 MPMoviePlayerViewController 处于全屏模式时,默认情况下其控件在叠加层上有上一个和下一个按钮。在我的项目中,我需要捕获该叠加按钮的单击并相应地处理它。由于我还不确定如何调用播放列表,因此没有下一个项目,单击该按钮会在退出全屏模式后中断视图。不知何故,它只是不知道该怎么做,我没有错误。

When the MPMoviePlayerViewController is in fullscreen mode on the iPad, it defaults to having its controls to have a previous and next button on the overlay there. In my project I need to capture the click for that overlay button and handle it accordingly. Since I'm not sure how to invoke a playlist just yet there is no next item and clicking on the button breaks the view once I exit fullscreen mode. Somehow it just doesn't know what to do and I get no errors.

我想知道的是,有没有办法从全屏接下来收听/捕捉该事件以前的按钮?

What I would like to know is if there a way to listen/catch that event from the fullscreen next and previous buttons?

我还尝试使用我自己的控件来覆盖 MPMoviePlayer MPMoviePlayerController ,以及 MPMoviePlayerViewController 但没有成功。一旦玩家进入全屏模式,任何存在的叠加都将被忽略,并且不随屏幕缩放一起进行。

I have also tried to get an overlay with my own controls to live on the MPMoviePlayer, MPMoviePlayerController, and the MPMoviePlayerViewController with no success. Once the player enters fullscreen mode any overlay that was present is ignored and not carried along with the screen zooming.

全屏模式下,是否有可靠的方法来覆盖?我查看了Apple的示例,但在全屏模式下,这对我来说实际上无法添加任何内容。

Is there a reliable way to have an overlay while in fullscreen mode? I have looked at the sample from Apple but this seems to not work for me to actually add anything to the view while in fullscreen mode.

任何帮助都将不胜感激。

Any help would be appreciated.

推荐答案

这是我偶然发现的另一种可能性。全屏模式下的MPMoviePlayerController可能正在发送远程控制事件。通过在视图控制器中启用远程控制事件消息来捕获这些(仅限iOS 4):

Here's another possibility I just stumbled across. The MPMoviePlayerController in full-screen mode may be sending Remote Control events. Catch these (iOS 4 only, by the way) by enabling remote control event messages in your view controller:

[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];

然后实施

[UIResponder remoteControlReceivedWithEvent:(UIEvent*)event];

当视图消失时,取消注册viewWillDisappear:

and when the view goes away, unregister in viewWillDisappear:

[[UIApplication sharedApplication] endReceivingRemoteControlEvents];
[self resignFirstResponder];

我不确定这是否有效,但值得一试。

I'm not certain that this will work, but it's worth a shot.

这篇关于如何在iPad上以全屏模式捕捉MPMoviePlayer下一次按钮点击事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆