I've got a UITextView that is not editable by default so that data detectors show addresses and phone numbers. I'd like to be able to let the user single tap anywhere in the text view to set it editable and put the insertion point there. Unfortunately, I can't get the insertion point and a single tap just enables editing of the text view (for an example of what i'm trying to accomplish, in Notes.app create a new note with a URL.)
I've subclassed UITextView and overrode - (void)touchesBegan:withEvent:
so that it checks to see if the text view is editable. If it's not, I enables editing.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if (!self.editable)
{
self.editable = YES;
}
[super touchesBegan:touches withEvent:event];
}
I'm unsure however where to proceed from there as just calling becomeFirstResponder
puts the insertion point at the top.