how to insert text at any cursor position in uitextview?

前端 未结 4 963
走了就别回头了
走了就别回头了 2021-02-13 01:42

i want to implement Code by which i can start to insert text at any position of cursor in UITextView in iphone sdk

any idea? thank you in advance..

i refereed th

4条回答
  •  余生分开走
    2021-02-13 02:20

    Here is the Glorfindel's answer in Swift3. The text its inserting here it pulls out of the clipboard.

    if let textRange = myTextView.selectedTextRange {
       myTextView.replace(textRange, withText:UIPasteboard.general.string!)
    }
    

提交回复
热议问题