Now I already detect long tap in UITextView
- (void)viewDidLoad
{
[super viewDidLoad];
UILongPressGestureRecognizer *LongPressgesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressFrom:)];
[[self textview] addGestureRecognizer:LongPressgesture];
longPressGestureRecognizer.delegate = self;
}
- (void) handleLongPressFrom: (UISwipeGestureRecognizer *)recognizer
{
CGPoint location = [recognizer locationInView:self.view];
NSLog(@"Tap Gesture Coordinates: %.2f %.2f", location.x, location.y);
}
Now, How should I do to get content of word which got long press, and get a rect of that word to prepare to show the PopOver?
UITapGestureRecognizer
you can replace it withUILongPressGestureRecognizer
. – Erlin