MPMoviePlayerController UIGestureRecognizer在全屏时不会触发

时间:2012-10-23 14:23:04

标签: ios ios6 mpmovieplayercontroller uigesturerecognizer

我有MPMoviePlayerController,它有一些UIGestureRecognizers。它在普通视图中运行良好,但是当玩家进入全屏时,即使事件被绑定,也不会触发事件。

以下是我绑定事件的方式:

UISwipeGestureRecognizer * nextChannelRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(gotoNextChannel)];
    [nextChannelRecognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];
    [[player.view.subviews objectAtIndex:0] setUserInteractionEnabled:YES];
    [[player.view.subviews objectAtIndex:0] addGestureRecognizer:nextChannelRecognizer];

    UISwipeGestureRecognizer * previousChannelRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(gotoPreviousChannel)];
    [previousChannelRecognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
    [[player.view.subviews objectAtIndex:0] addGestureRecognizer:previousChannelRecognizer];

    for (UIGestureRecognizer *g in ((UIView *)[player.view.subviews objectAtIndex:0]).gestureRecognizers) {
        NSLog(@"g %@", g.class);
    }

在普通视图和全屏视图中,循环中的代码输出这些

MPTapGestureRecognizer
MPSwipeGestureRecognizer
UIPinchGestureRecognizer
MPActivityGestureRecognizer
UITapGestureRecognizer
UITapGestureRecognizer
UIPinchGestureRecognizer
UISwipeGestureRecognizer
UISwipeGestureRecognizer

我尝试使用播放器视图的视图边界添加另一个临时视图,并将相同的事件绑定到它,但结果是相同的。

你能告诉我为什么它不起作用吗?怎么了?

0 个答案:

没有答案