uiimageview cabasicanimation消失效果

时间:2014-12-27 18:34:43

标签: ios animation uiimageview effect cabasicanimation

我希望图像越来越小,最后消失。我无法通过cabasicanimation实现这一目标。我该怎么用?

CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"transform"];
        anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        anim.duration = 1.0;
        anim.repeatCount = 1;
        anim.autoreverses = YES;
        anim.removedOnCompletion = YES;
        anim.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.01, 0.01, 1.0)];
        [_tile1.layer addAnimation:anim forKey:nil];

1 个答案:

答案 0 :(得分:0)

你可以试试这个,

UIImageView *imgView;

[UIView animateWithDuration:0.5 animations:^{
    imgView.transform = CGAffineTransformScale(imgView.transform, 0.1, 0.1);
} completion:^(BOOL finished) {
    [imgView removeFromSuperview];
    imgView.image =nil;
    imgView = nil;
}];