UITextview: Place focus on startfirstresponder

I have a UITextView that becomes the first responder by clicking. The code is as follows.

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];
}

So, when the user clicks on the text image, the text representation becomes the first responder and the focus is at the end of the text. I want to focus on the tapped position in the text.

Any idea?

+1
source share

All Articles