Is there any way to only use certain aspects of the transform identity when I'm resetting something to its CGAffineTransformIdentity?
I have this method that resets my image view:
- (void)resetImage
{
[UIView beginAnimations:nil context:nil];
[firstImageView setTransform:CGAffineTransformIdentity];
[UIView commitAnimations];
}
But I now want to make a new method that centers the image but leaves everything else about the transform i.e.(scale, rotation).
Is this something I can do simply so I can use an animation block like in my resetImage method? Or do I need to go a far more complicated route?
Thanks in advance!
just as a warning, I have very little experience with CG so take it 开发者_运维问答easy on me :)
The identity transformation has no aspects. You're not saying “subtract all the things I did to it before” (such that you could exclude some of those things from the subtraction); you are resetting it to its initial, non-transformative value.
But I now want to make a new method that centers the image but leaves everything else about the transform i.e.(scale, rotation).
I assume you mean “leaves everything else … out”.
Then you need to make a transformation that contains the translation(s), but not the scale or rotation.
精彩评论