动画显示不需要的阴影

时间:2014-08-26 17:31:58

标签: ios objective-c core-animation uiviewanimation

我正在动画一幅图像向上移动50px,但随着它移动,它会留下一个阴影。如何删除此阴影?我希望图像顺利移动。阴影只存在于动画的开头。

使用的方法:

- (void)moveImage:(UIImageView *)image duration:(NSTimeInterval)duration
            curve:(int)curve x:(CGFloat)x y:(CGFloat)y
{
    // Setup the animation
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:duration];
    [UIView setAnimationCurve:curve];
    [UIView setAnimationBeginsFromCurrentState:YES];

    // The transform matrix
    CGAffineTransform transform = CGAffineTransformMakeTranslation(x, y);
    image.transform = transform;

    // Commit the changes
    [UIView commitAnimations];  
}

调用方法:

[self moveImage:imageToMove duration:1.0
              curve:UIViewAnimationCurveLinear x:0.0 y:-70.0];

图像: enter image description here

0 个答案:

没有答案