1
我有一个AVPlayerViewController,它将在其顶部有一些视图(仅当它处于全屏模式时)。视图上有手势识别器(这些工作)。问题是,当用户点击其中一个视图(他们是不可见的)时,玩家也不会收到触摸...我需要玩家显示玩家控件然后..将点击手势从UIView传递到底层AVPlayer
这就是我添加
_topHelperView = [[UIView alloc] init];
_topHelperView.backgroundColor = [UIColor purpleColor];
_middleHelperView = [[UIView alloc] init];
_middleHelperView.backgroundColor = [UIColor redColor];
[self setHelperFrames];
_topTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleHelperTapGesture:)];
_topTapGestureRecognizer.delegate = self;
_topTapGestureRecognizer.cancelsTouchesInView = NO;
_middleTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleHelperTapGesture:)];
_middleTapGestureRecognizer.cancelsTouchesInView = NO;
_middleTapGestureRecognizer.delegate = self;
我还实施了委托的看法:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
return YES;
}
// this enables you to handle multiple recognizers on single view
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
NSLog(@"should Handle simultaneously %@ %@",gestureRecognizer,otherGestureRecognizer);
return YES;
}
这不工作..播放器不显示控件时,无论视图被窃听..那只能说明他们的时候它直接点击.. 任何解决方法?