3
我想趕上UIGestureRecognizer
的類型。 我可以這樣做嗎?UIGestureRecognizer類型catch在gestureRecognizerShouldBegin
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
NSLog(@"Gesture should begin");
if ([gestureRecognizer isMemberOfClass:[UIRotationGestureRecognizer class]])
NSLog(@"rotate");
if ([gestureRecognizer isMemberOfClass:[UIPinchGestureRecognizer class]])
NSLog(@"pinch");
if ([gestureRecognizer isMemberOfClass:[UITapGestureRecognizer class]])
NSLog(@"tap");
if ([gestureRecognizer isMemberOfClass:[UIPanGestureRecognizer class]])
NSLog(@"pan");
if ([gestureRecognizer isMemberOfClass:[UILongPressGestureRecognizer class]])
NSLog(@"long");
if ([gestureRecognizer isMemberOfClass:[UISwipeGestureRecognizer class]])
NSLog(@"swipe");
return NO;
}
我在表格視圖單元格中有一個很長的觸摸手勢。 如果我按單元格我收到日誌:
-[FileObjectView gestureRecognizerShouldBegin:] [Line 45] Gesture should begin
-[FileObjectView gestureRecognizerShouldBegin:] [Line 55] long
而且我希望它以這種方式工作。
但有時當我滾動我的表視圖,我收到一個日誌:
-[FileObjectView gestureRecognizerShouldBegin:] [Line 45] Gesture should begin
這讓我覺得,我不知道某些類型的手勢。
can anybode可以解釋情況嗎?
雅,它爲我工作.. – Avinash