【发布时间】:2012-07-05 17:29:06
【问题描述】:
现在我已经在 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);
}
现在,我应该如何获取长按的单词内容,并获取该单词的矩形以准备显示 PopOver?
【问题讨论】:
-
请查看stackoverflow.com/questions/8811909/…。我用过
UITapGestureRecognizer,你可以用UILongPressGestureRecognizer替换它。
标签: objective-c ios uigesturerecognizer uipopovercontroller