【发布时间】:2010-10-21 15:01:58
【问题描述】:
在下面的UIView 动画块中,我做了一个CGAffineTransformMakeScale 和一个CGAffineTransformMakeRotation,虽然duration 设置为1.0f,,但比例真的很快,旋转就像它一样在1 秒内完成应该。
这一定是我对AffineTransforms的应用方式缺乏了解,但我想不通。
什么给了?
编辑:弗拉基米尔的回答效果很好。我将同一个属性更改了两次,而不是更改了两个属性。要对transform 属性进行两次更改,您必须使用初始更改进行transform,然后将第二次更改添加到transform,然后从那里设置对象的transform。通过这种方式,您可以将任意数量的链接链接在一起。
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];
【问题讨论】:
标签: iphone animation uiview ios