Control cursor position in UITextField

后端 未结 7 2186
你的背包
你的背包 2020-11-29 00:52

I have a UITextField that I\'m forcing formatting on by modifying the text inside the change notification handler. This works great (once I solved the reentranc

7条回答
  •  伪装坚强ぢ
    2020-11-29 01:32

    I don't think there is a way to place the cursor at a particular place in your UITextField (unless you got very tricky and simulated a touch event). Instead, I'd handle formatting when the user has finished editing their text (in textFieldShouldEndEditing:) and if their entry is incorrect, don't allow the text field to finish editing.

提交回复
热议问题