When I am trying to rotate a view in iOS
its coordinates changed.
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 .
self.frame = CGRectMake(0, 0, screenWidth, screenHeight);
NSLog(@"BEFORE %@", NSStringFromCGRect(self.frame));
self.transform = CGAffineTransformMakeRotation(M_PI_2);
NSLog(@"AFTER %@", NSStringFromCGRect(self.frame));
here is the Log
BEFORE {{0, 0}, {414, 636}}
AFTER {{-161, 160.99999999999997}, {636, 414}}
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 .