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

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -