Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CATransform3D - go back to previous state

Hi I`m working with CATransform3D. Every time that I call the following method with the variable radian the UIImageView is rotated “radian * M_PI” from the previous angle. I trying to go back to the original state. There is any way to do that? I mind I want to sent a radian value i.e. 10 and that the view maintain these angle if is called more than once.

METHOD:


CATransform3D rotatedTransform = self.needleB.layer.transform;
rotatedTransform = CATransform3DRotate(rotatedTransform, radian * M_PI / 180.0, 0.0f, 0.0f, 1.0f);
self.needleB.layer.transform = rotatedTransform;
self.needleB.layer.anchorPoint = CGPointMake(0.5, 0.9);
self.needleB.center = CGPointMake(160, 250);

Thanks !!

like image 302
Ezequiel Ing Avatar asked Jan 02 '13 23:01

Ezequiel Ing


1 Answers

To undo all transforms, assign the transform property of your layer to CATransform3DIdentity.

like image 161
CodaFi Avatar answered Nov 11 '22 11:11

CodaFi