title: Limit characters by UITextView height
body: <p>Using the following code I'm attempting to limit the height of my <code>UITextView</code> by disallowing the user to enter characters once the <code>UITextView</code> is beyond a certain content size. But the problem is that with the current code, the last character after the height limit is written anyway such that one character ends up on its own line alone and that line is beyond the height limit.</p>
  
  <p>How I can fix my code so that the text doesn't go past my height limit?</p>
  
  <pre><code>func textView(textView: UITextView, shouldChangeTextInRange range: NSRange, replacementText text: String) -&gt; Bool {
  
      var frame:CGRect = textView.frame;
  
      frame.size.height = textView.contentSize.height;
  
      if(frame.size.height &lt;= 33.0){
          return true  
      }
      else {
          return false
      }
  }
  </code></pre>