我已经制作了自定义手势识别器并将其添加到我的customView中。 自定义手势是UIPanGestureRecognizer的子类。
我添加的另一个手势是LongPressGestureRecognizer
CustomGestureRecognizer *pan;
pan = [[CustomGestureRecognizer alloc] initWithTarget:[self viewController] action:@selector(dragImage:)];
[pan setDirection:DirectionPangestureRecognizerVertical];
[pan setMinimumNumberOfTouches:1];
[pan setMaximumNumberOfTouches:1];
[custom addSubview:custom.imageView];
[custom addGestureRecognizer:pan];
[pan release];
UILongPressGestureRecognizer *highLight = [[UILongPressGestureRecognizer alloc] initWithTarget:[self viewController]
action:@selector(highlightImage:)];
[highLight setDelaysTouchesBegan:0.1];
[tempView addGestureRecognizer:highLight];
[highLight release];
我也实施了
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
if (![gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] && ![otherGestureRecognizer isKindOfClass:[UITapGestureRecognizer class]])
{
return YES;
}
return YES;
}
我的[自我视图控制器]和自我课程,但我仍然没有得到两个手势同时工作。
答案 0 :(得分:0)
您忘了设置手势识别器的代表......永远不会调用该方法。