Is there a way to prevent the user from moving the cursor in a UITextField? I'd like it to stay at the end of the string.
See Question&Answers more detail:osIs there a way to prevent the user from moving the cursor in a UITextField? I'd like it to stay at the end of the string.
See Question&Answers more detail:osThis is an old question, but I was looking for an answer to the same question, and found a solution.
It is actually quite simple to prevent the user from moving the cursor. Just subclass UITextField and provide the following implementation of caretRectForPosition:
- (CGRect)caretRectForPosition:(UITextPosition *)position
{
return [super caretRectForPosition:self.endOfDocument];
}