我在SO上跟踪了这个答案:set
但我收到错误“预期表达”。我做错了什么?
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch;
{
BOOL shouldReceiveTouch = YES;
if (gestureRecognizer == tap) { //Expected Expression
shouldReceiveTouch = (touch.view == _shownImage);
}
return shouldReceiveTouch;
}
答案 0 :(得分:1)
您可以查看UIGestureRecognizer类
-(BOOL) gestureRecognizer: (UIGestureRecognize *) gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer: (UIGestureRecognizer *) otherGestureRecognizer {
if ([gestureRecognizer isMemberOfClass: [UITapGestureRecognizer class]]) {
shouldReceiveTouch = (touch.view == _shownImage);
}
}
答案 1 :(得分:1)
您必须tap(UITapGestureRecognizer)
检查UIGestureRecognizer
手势是isMemberOfClass
的成员。
-(BOOL) gestureRecognizer: (UIGestureRecognize *) gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer: (UIGestureRecognizer *) otherGestureRecognizer {
if ([gestureRecognizer isMemberOfClass: [tap class]]) {// please check this one
}
}