是否可以实例化UITextRange和UITextField的第一个字符?我需要访问UITextField的第一个角色,有人能帮我吗?
提前感谢
发布于 2014-03-13 03:52:39
您可以使用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];https://stackoverflow.com/questions/22348076
复制相似问题