uiimageview cabasicanimation消失效果
问题描述:
我希望图像越来越小,最后消失。 cabasicanimation我无法实现。我应该使用什么?uiimageview 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];
答
你可以试试这个,
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;
}];