Search code examples
iphoneobjective-ccocoa-touchcore-animationcgaffinetransform

Find new coordinates after using CGAffineTransformMakeRotation on an object


This is a simple issue, which is bugging me ...

So, I have an object of UIImageView over which, I use

-(void)rotate {

// ...

CGAffineTransform transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(180));
self.image.transform = transform; // image is a property.

}

So, when I call this method once, it rotates the object !. When I call the method again, I expect the object to be rotated again - but it is not rotating by another 180 degrees. After messing with the coordinates and moving the image, I can understand that the -perspective of the object has also be rotated by 180 degrees and all coordinates have been inverted as well.

I want the object's perspective to be restored (although it's been rotated by some angle) such that, I can continue to rotate and move it just like before !

Any ideas ?


Solution

  • Solved the problem with CABasicAnimation !