当用户点击 UITextView 时,我需要在 UITextView 的第一个位置设置光标。NSMakeRange
没有帮助我,但我在How to set cursor position for UITextView on user input? 中找到了解决方案?
我在我的 UITextView 中添加了 tapGesture。但它只工作一次,第一次,为什么?
textViewMessage.gestureRecognizers = nil;
UITapGestureRecognizer *tapTextView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapTextView)];
[textViewMessage addGestureRecognizer:tapTextView];
这个方法只调用一次
- (void)tapTextView
{
[textViewMessage becomeFirstResponder];
}