title: Display text in textfield has a strange behavior
body: <p>I'm trying to create a particular textfield. As any chat application you have a textfield where you can write your message and send it. This field increase its height to 3 lines of text before it becomes scrollable.</p>
  
  <p>In my case, the textfield is made like that :</p>
  
  <p><a href="https://i.stack.imgur.com/B7rpr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B7rpr.png" alt="enter image description here"></a></p>
  
  <p>In orange it is the textfield zone, on the right you can see the sending button with an image view in it. All these elements are included in a view that you can see around the textfield.</p>
  
  <p>The only height constraint is put on the textfield.</p>
  
  <p>To adapt the height of the textfield to the height of its content I'm using the following code :</p>
  
  <pre><code>func textViewDidChange(textView: UITextView)
      {
  
          contentSize = textField.contentSize.height
  
          if(previousContentSize != contentSize)
          {
              //textField.sizeThatFits(CGSize(width: view.bounds.width - 55, height: 0))
              heightTextfieldConstraint.constant = textField.contentSize.height
          }
  
          previousContentSize = contentSize
  
      } 
  </code></pre>
  
  <p>And this function is called in every change in the textfield. </p>
  
  <p>It works, but in a strange way. Indeed when there is the second line return the text appears like that :</p>
  
  <p><a href="https://i.stack.imgur.com/mgncT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mgncT.png" alt="enter image description here"></a></p>
  
  <p>And then when there is the third line return : </p>
  
  <p><a href="https://i.stack.imgur.com/DgXcM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DgXcM.png" alt="enter image description here"></a></p>
  
  <p>Why the contentInset Top is not good when there is the second line and is good when there is the third one ? </p>
  
  <p>I've tried to use <code>sizeToFit()</code> but I didn't have any good result. </p>