我正在使用计时器和动画块移动图像视图。同时,用户可以单击其中一些视图(按钮),然后我有更多的动画块开始移动/调整大小/旋转不同的图像视图。
更改视图的 alpha 并将新的 CGpoint 分配给视图对我来说效果很好,但是使用 uiview.transform 函数调用调整大小或旋转似乎会将我的所有视图重置为它们的起始位置(从情节提要)。
我真的很想能够在动画块中使用这个变换功能,但是如果我不能以某种方式绕过这个重置,它对我来说并不是一个真正可行的选择。
示例代码:
- (void)moveGust:(NSTimer*) timer
{
if(centerCloud1.x >= 1100)
{
centerCloud1.x = -79;
gustOutlet.center = centerCloud1;
}
if(centerCloud2.x >= 1100)
{
centerCloud2.x = -79;
cloudOutlet.center = centerCloud2;
}
centerCloud1 = gustOutlet.center;
centerCloud1.x = round(centerCloud1.x+10);
centerCloud2 = cloudOutlet.center;
centerCloud2.x = round(centerCloud2.x+8);
[UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveLinear animations:^(void){
gustOutlet.center = centerCloud1;
cloudOutlet.center = centerCloud2;
}completion:^(BOOL Finished){ }];
}
- (IBAction)signAction:(id)sender {
[UIView animateWithDuration:0 animations:^(void) {
signTop.transform = CGAffineTransformScale(signTop.transform, 1.1, 1.1);
}];
}
有任何想法吗?谢谢!