一些CGAffine动画会对您不期望的矩阵组件进行假设。
例如,我发现CGAffineTransformMakeTranslation也影响了视图的旋转。出于这个原因,我建议不要使用'生成'转换,如果您的连接许多实例CGAffineTransform
另外,在上面的例子中,变换矩阵是在任何时间点关于对象的一组物理属性。
希望对象移动到 - 锚定 和规模
希望对象移动到回 锚
这些应被视为两个不同的动画
你应该用'关键帧动画'来做到这一点,这里是一个例子:CGPath Animation
或者,您可以将两个CGAffineTransform方法链接在一起。
-(void)Anim1
{
[UIView beginAnimations:@"Anim1_Done" context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
//DO STUFF HERE
[UIView commitAnimations];
}
- (void)animationFinished:(NSString *)animationID finished:(BOOL)finished context:(void *)context
{
if ([animationID isEqualToString:@"Anim1_Done"])
{
[self Anim2];
}
}
-(void)Anim2
{
[UIView beginAnimations:@"Anim2_Done" context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
//DO STUFF HERE
[UIView commitAnimations];
}