한 인스턴스 UIGestureRecognizer에서 모든 유형의 제스처를 포착 할 수 있는지 알아야합니다.모든 유형의 제스처 인식기
예 : I는 I 그렇게하는 방법이 제스처
각 유형의 인스턴스를 생성하지 않고 이루어 탭의 임의의 타입을 검출 할 UIView의 있나?
감사합니다,
한 인스턴스 UIGestureRecognizer에서 모든 유형의 제스처를 포착 할 수 있는지 알아야합니다.모든 유형의 제스처 인식기
예 : I는 I 그렇게하는 방법이 제스처
각 유형의 인스턴스를 생성하지 않고 이루어 탭의 임의의 타입을 검출 할 UIView의 있나?
감사합니다,
오프 물론, 자신 (Event Handling Guide for iOS)에 의해 낮은 수준의 UIView의 이벤트를 처리한다 :
Responding to Touch Events
– touchesBegan:withEvent:
– touchesMoved:withEvent:
– touchesEnded:withEvent:
– touchesCancelled:withEvent:
Responding to Motion Events
– motionBegan:withEvent:
– motionEnded:withEvent:
– motionCancelled:withEvent:
당신은 UIGestureRecognizer
클래스를 서브 클래스 화해와 접촉을 시작하면 UIGestureRecognizerStateRecognized
에 내부 상태를 변경할 수 있습니다.
샘플 코드 :
@interface UITouchGestureRecognizer : UIGestureRecognizer
@end
#import <UIKit/UIGestureRecognizerSubclass.h>
@implementation UITouchGestureRecognizer
- (void) reset
{
[super reset];
}
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
self.state = UIGestureRecognizerStateRecognized;
}
@end