3

I am attempting to add a Newline or Carriage return in a UITextView.

    var text = UITextField()
    text.text = "This is a text \r\n This is a text"

The result shows the entire text on one line:

This is a text This is a text

Is it not possible to do a Newline or CR in a UITextView? Or what am I missing here?

Pete
  • 613
  • 1
  • 6
  • 18
  • possible duplicate of http://stackoverflow.com/questions/1345561/how-to-create-a-multiline-uitextfield – Jakub Vano Jun 05 '15 at 11:29
  • Your first line says that you want carriage return in UITextView, but then. the code shows otherwise. – Sandeep Jun 05 '15 at 11:31

1 Answers1

7

UITextField is generally single-line and does not support multiline text. Use a UITextView instead

lostInTransit
  • 70,519
  • 61
  • 198
  • 274