美文网首页
购物车常用的动画类—ios

购物车常用的动画类—ios

作者: 40dd4b561abe | 来源:发表于2017-06-14 09:41 被阅读15次
    #import "UIImageView+shopCar_animation.h"
    
    @implementation UIImageView (shopCar_animation)
    
    -(void)shopCar_animtion_frame:(CGPoint) center end_block:(void(^)())block
    
    {
    
    UIView * views = [UIApplication sharedApplication].delegate.window;
    
    CGPoint point = [views convertPoint:self.center fromView:self];
    
    UIImageView * image = [[UIImageView alloc]initWithFrame:self.bounds];
    
    image.backgroundColor = [UIColor redColor];
    
    image.image = self.image;
    
    image.center = point;
    
    [views addSubview:image];
    
    [UIView animateWithDuration:.5 animations:^{
    
    image.center = center;
    
    CGAffineTransform transform = CGAffineTransformScale(image.transform, .1, .1);
    
    image.transform =transform;
    
    } completion:^(BOOL finished) {
    
    if (block) {
    
    block();
    
    }
    
    [image removeFromSuperview];
    
    }];
    
    }
    
    @end
    
    

    相关文章

      网友评论

          本文标题:购物车常用的动画类—ios

          本文链接:https://www.haomeiwen.com/subject/erksqxtx.html