UITextview:把重点放在成为第一反应者身上

时间:2014-08-07 06:52:22

标签: ios uitextview uitapgesturerecognizer becomefirstresponder

我有一个UITextView,通过点击成为第一响应者。代码看起来像这样。

UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(editTextRecognizerTabbed:)];
recognizer.delegate = self;
recognizer.numberOfTapsRequired = 1;
[self.textViewNotes addGestureRecognizer:recognizer];

- (void) editTextRecognizerTabbed:(UITapGestureRecognizer *) aRecognizer;
{
    self.textViewNotes.dataDetectorTypes = UIDataDetectorTypeNone;
    self.textViewNotes.editable = YES;
    [self.textViewNotes becomeFirstResponder];
}

因此,当用户点击文本视图时,textview将成为第一个响应者,焦点位于文本末尾。我想把重点放在文本中的轻敲位置。

有什么想法吗?

0 个答案:

没有答案