4
UIScrollView에서 길게 탭 (탭하고 누르고 있음)을 어떻게 감지합니까?UIScrollView에서 긴 탭 감지
UIScrollView에서 길게 탭 (탭하고 누르고 있음)을 어떻게 감지합니까?UIScrollView에서 긴 탭 감지
보기의 touchesBegan:
에서 "지연 탭"핸들을 약간 지연시켜 호출 할 수 있습니다. 충분한 시간이 경과 한 경우 뷰의 touchesEnded:
에서
[touchHandler performSelector:@selector(longTap:) withObject:nil afterDelay:1.5];
당신은 전화를 취소 할 수 있습니다
[NSObject cancelPreviousPerformRequestsWithTarget:touchHandler selector:@selector(longTap:) object:nil];
//Add gesture to a method where the view is being created. In this example long tap is added to tile (a subclass of UIView):
// Add long tap for the main tiles
UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTap:)];
[tile addGestureRecognizer:longPressGesture];
[longPressGesture release];
-(void) longTap:(UILongPressGestureRecognizer *)gestureRecognizer{
NSLog(@"gestureRecognizer= %@",gestureRecognizer);
if ([gestureRecognizer state] == UIGestureRecognizerStateBegan) {
NSLog(@"longTap began");
}
}
thanksssssssss을! 네가 내 목숨을 구했어! (+1) – SpaceDog