title: How to limit the number of lines in UITextView?
body: <p>I have a UITextView in my screen, the user should fill only <strong>two lines</strong>, and when the user in the second line the return key should turn into <strong>Done</strong>. </p>
  
  <p>How can I limit the number of <strong>lines</strong> in UITextView? 
  I searched a lot, and no results was useful! </p>
  
  <p>I found this answer for Swift: </p>
  
  <pre><code>locationNoteTextView.textContainer.maximumNumberOfLines = 2
  self.locationNoteTextView.textContainer.lineBreakMode = NSLineBreakMode.ByClipping
  </code></pre>
  
  <p>It didn't work, by this way the user can enter infinity character, but what viewed on the screen are just two lines!</p>
  
  <p>So if you tried to print the text of textView you will find a disaster text.</p>