I have a UITextField
and like every self-respecting UITextField
, it is possible to hold on it and scroll it by moving the cursor ( also called caret ).
I'd like to know if there is a way to disable this feature ?
Asked
Active
Viewed 99 times
0

Randy
- 4,335
- 3
- 30
- 64
1 Answers
2
I based my answer using this post: https://stackoverflow.com/a/16586297/6611229 but I made changes to solve an issue. You can create a subclass of UITextField and add the following methods to the class:
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
self.selectedTextRange = [self textRangeFromPosition:self.endOfDocument
toPosition:self.endOfDocument];
return NO;
}
- (CGRect)caretRectForPosition:(UITextPosition*)position
{
return [super caretRectForPosition:self.endOfDocument];
}

Community
- 1
- 1

Juan Garcia
- 200
- 2
- 9