相关疑难解决方法(0)

从UITextView的单词中获取单词

现在我已经在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);
    }
Run Code Online (Sandbox Code Playgroud)

现在,我该如何获取长按的单词内容,并获得该单词的矩形以准备显示PopOver?

objective-c uipopovercontroller uigesturerecognizer ios

5
推荐指数
1
解决办法
3043
查看次数