0

Can someone show me how to move the textView cursor downward cause I don't know how to do it, Also where should I put it in the textViewDidBeginEditing(_ textView: UITextView) or in the textViewDidEndEditing(_ textView: UITextView) Thanks in advance

rmaddy
  • 307,833
  • 40
  • 508
  • 550
Jose
  • 47
  • 1
  • 9

1 Answers1

1

This will move coursor to the end of text:

 func textViewShouldBeginEditing(_ textView: UITextView) -> Bool {
        DispatchQueue.main.async {
            textView.selectedRange = NSRange(location: textView.text.count, length: 0)
        }
        return true
    }

If you want to begin text from a new line, add this, before return true:

textView.text = textView.text + "\n"

If you want to skip two lines, make it "\n\n", and so on.

David Kyslenko
  • 727
  • 1
  • 9
  • 24