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

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -