0
我做了一個自定義的手勢識別器,並將其添加到我的自定義視圖。 自定義手勢是UIPanGestureRecognizer的一個子類。多個手勢似乎沒有工作(* CustomGestureRecognizer和UILongPressGestureRecognizer)
其他手勢,即時通訊將是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;
}
兩個IM我的[自我的viewController],並在自我類,但即時通訊仍然沒有得到兩個手勢工作simultaniiosly。