Rotate a view 90 degree iOS
<p>When I am trying to rotate a view in <code>iOS</code> its coordinates changed.  </p>

<p>I want to rotate a rectangle view 90 degree, but my problem is that the view does not located in its frame correctly after rotation .</p>

<pre><code>self.frame = CGRectMake(0, 0, screenWidth, screenHeight);
  NSLog(@"BEFORE %@", NSStringFromCGRect(self.frame));

 self.transform = CGAffineTransformMakeRotation(M_PI_2);

 NSLog(@"AFTER %@", NSStringFromCGRect(self.frame));
</code></pre>

<p>here is the Log </p>

<pre><code>     BEFORE {{0, 0}, {414, 636}}
     AFTER {{-161, 160.99999999999997}, {636, 414}}
</code></pre>

<p>U can see that the X and Y coordinates has changed, this leads the view to be sets incorrectly on its container. I cant understand the formula of changing them to be considered when setting the frame .</p>