是否可以实例化UITextRange和 的第一个字符UITextField?我需要访问 rect 的UITextField第一个字符,有人可以帮助我吗?
提前致谢
是否可以实例化UITextRange和 的第一个字符UITextField?我需要访问 rect 的UITextField第一个字符,有人可以帮助我吗?
提前致谢
UITextRange您可以使用以下提供的方法手动创建UITextInput:
UITextPosition *firstCharacterPosition = [textField beginningOfDocument];
UITextPosition *secondCharacterPosition = [textField positionFromPosition:firstCharacterPosition offset:1];
UITextRange *firstCharacterRange = [textField textRangeFromPosition:firstCharacterPosition toPosition:secondCharacterPosition];
NSString *firstCharacter = [textField textInRange:firstCharacterRange];