title: Re-arrange UILabel after new line
body: <p>I have a label which gets its text from textfield and has a limit in width of imageview where it is on. I want to add a new line when the limit has reached. However, i couldn't do it with "\n" and wordwrapping function. In addition, i need to set UILabel's height and width to exactly texts size. I mean if it has two lines height should for two line only not much and exact same for the width property.</p>
  
  <pre><code>func textFieldShouldEndEditing(_ textField: UITextField) -&gt; Bool {
     if(imageview.frame.width &gt; label.frame.width + 2)
     {
      label_test.text = "\(label.frame.width)"
       label.text = textfield.text
          if(imageview.frame.width &lt; label.frame.width + 20)
          {
              label.lineBreakMode = .byWordWrapping
              label.text = textfield.text! + "\n"
              label.textAlignment = NSTextAlignment.center;
          }
      }
      return true
  }
  </code></pre>