How to get touch/click on a MPMoviePlayerController view when MPMovieControlStyle = MPMovieControlStyleNone

ε祈祈猫儿з 提交于 2019-12-07 10:12:38

问题


In one of my application, I don't want to show any video controllers. But I need to get the touch on the media player view. I need to do some other action on touch on the movie player. How can I implement that. Please help

Thanks in advance.


回答1:


You can always attach a UITapGestureRecognizer to the view and handle the taps.

UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
[moviePlayer.view addGestureRecognizer:tap];
[tap release];

And handle the tap in handleTap:

- (void)handleTap:(UITapGestureRecognizer *)gesture {
    // Do some other action as intended.
}

Of course this works only on iOS 3.2 and later.




回答2:


You can also use this delegate method of UIGestureRecognizer.

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch;


来源:https://stackoverflow.com/questions/6384607/how-to-get-touch-click-on-a-mpmovieplayercontroller-view-when-mpmoviecontrolstyl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!