Getting and Setting Cursor Position of UITextField and UITextView in Swift

后端 未结 4 1001
遥遥无期
遥遥无期 2020-11-22 17:10

I\'ve been experimenting with UITextField and how to work with it\'s cursor position. I\'ve found a number of relation Objective-C answers, as in

4条回答
  •  忘了有多久
    2020-11-22 17:42

    For set cursor position at your point:

    textView.beginFloatingCursor(at: CGPoint(x: 10.0, y: 10.0))
    

    For reset cursor position:

    textView.endFloatingCursor()
    

    Note: This example works in both Textview & Textfield.

提交回复
热议问题