0
我有一个UITextField
和每个自尊的UITextField
一样,可以保持并通过移动光标(也称为脱字符)来滚动它。 我想知道是否有办法禁用此功能?如何禁用保持并滚动UITextField
我有一个UITextField
和每个自尊的UITextField
一样,可以保持并通过移动光标(也称为脱字符)来滚动它。 我想知道是否有办法禁用此功能?如何禁用保持并滚动UITextField
我基于我的回答,使用这个职位:https://stackoverflow.com/a/16586297/6611229但我做了更改解决一个问题。 您可以创建的UITextField的一个子类,下面的方法添加到类:
- (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];
}
是的,它的伎俩感谢:) – Randy