In the following UIView
animation block, I do a CGAffineTransformMakeScale
and a CGAffineTransformMakeRotation
, and though the duration
is set to 1.0f,
the scale goes really fast and the rotation goes in 1 second like it should.
It must be my lack of understanding about how AffineTransforms
are applied but I can't figure it out.
What gives?
EDIT: Vladimir's answer worked great. I was changing the same property twice, rather than changing two properties. To make two changes to a transform
property, you have to make a transform
with the initial change, then add the second change to that transform
and then set you object's transform
from there. This way, you can chain as many together as you want.
CGColorRef color = [[colorArray objectAtIndex:colorIndex] CGColor];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0f];
[[self layer] setFillMode:kCAFillModeForwards];
[self setTransform:CGAffineTransformMakeScale(2.0, 2.0)];
[self setTransform:CGAffineTransformMakeRotation(M_PI / 4)];
[[self layer] setBackgroundColor:color];
[UIView commitAnimations];