iPhone
[obj-c] UILongPressGesture [gesture]
tenn
2012. 11. 21. 15:25
LongPress의 down과 up만 체크
UILongPressGestureRecognizer *longPressGesture =
[[UILongPressGestureRecognizer alloc] initWithTarget:self
action:@selector(handleLongPress:)];
[targetView addGestureRecognizer:longPressGesture];
.....
// Handler
- (void)handleLongPress:(UILongPressGestureRecognizer *)recognizer {
CGPoint location = [recognizer locationInView:[recognizer.view superview]];
if (recognizer.state == UIGestureRecognizerStateBegan) {
NSLog(@" long press start ... ");
}else if(recognizer.state == UIGestureRecognizerStateEnded){
NSLog(@" long press ended ... ");
}
}