title: Rotating UITextView programmatically
body: <p>There is a weird problem, if you create a <code>UITextView</code> and rotate it right after creating it, some lines or characters will not be visible! Try this:</p>
  
  <pre><code>myTextView.font = UIFont.boldSystemFontOfSize(20)
  myTextView.text = "Hello world wht the hell\nhello mrs lorem ipum!"
  let maxsize = CGSizeMake(700, 700)
  let frame = myTextView.sizeThatFits(maxsize)
  myTextView.frame = CGRectMake(200, 200, frame.width, frame.height)     
  view.addSubview(myTextView)
  myTextView.transform = CGAffineTransformMakeRotation(CGFloat(M_PI_2))
  </code></pre>
  
  <p>Result: 
  <img src="https://i.stack.imgur.com/efOuI.png" alt="enter image description here"></p>
  
  <p>You see? most of is lost! But if you <code>remove myTextView.transform = CGAffineTransformMakeRotation(CGFloat(M_PI_2))</code> and run it through a button it's fine:</p>
  
  <p><img src="https://i.stack.imgur.com/CjvHr.png" alt="enter image description here"></p>
  
  <p>You can view the code on git: <a href="https://github.com/maysamsh/rotateTextView" rel="nofollow noreferrer">https://github.com/maysamsh/rotateTextView</a></p>