ios - UITextView.text with emoji setting: cursorPosition is not correct -
here, str
contains emojis , set cursorposition not correct:
let cursorposition = str.characters.count let cursorrange = nsrange(location: cursorposition, length: 0) textinputview.selectedrange = cursorrange textinputview.scrollrangetovisible(cursorrange)
it want put cursor @ last of textview
. try way.
textinputview.becomefirstresponder() let cursorposition = str.utf16.count let cursorrange = nsrange(location: cursorposition, length: 0) textinputview.selectedrange = cursorrange textinputview.scrollrangetovisible(cursorrange)
Comments
Post a Comment