【发布时间】:2013-03-18 02:42:22
【问题描述】:
我在 customView 中使用 UITextInput:
我的代码:https://github.com/lequysang/github_zip/blob/master/UITextInputDebug.zip
@property (strong,nonatomic) id<UITextInput> textInput;
键入一些字符后,我想返回 4 个字符并替换此位置的文本(将任何替换为 T)。当前光标在末尾。
怎么做?
我尝试使用 UITextRange 替换Range,但不知道如何获取位置和大小!
请帮忙!提前致谢!
【问题讨论】:
-
在当前光标位置插入文本?对不起,我没有得到你..
-
我只是找到了 insertText 方法。并且“文本”已经插入。我想要返回 4 个字符并在这个位置替换。
-
你试过“replaceRange:withText:”吗?
-
注意:您的
textInput属性应该很弱。强大的代表可能会导致保留周期。
标签: ios objective-c uitextinput