UIImageView 动画

    UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(10, 100, 300, 160)];
    imageView.backgroundColor=[UIColor blueColor];
    UIImage *image=[UIImage imageNamed:@"png1"];
    imageView.image=image;
    //设置图片的适应模式
    imageView.contentMode=UIViewContentModeScaleToFill;
    
    //动画
    imageView.animationDuration=1.5;
    NSMutableArray *images=[NSMutableArray array];
    for (int i=1; i<=13; i++) {
        [images addObject:[UIImage imageNamed:[NSString stringWithFormat:@"png%d",i]]];
    }
    //这个是重点
    imageView.animationImages=images;
    imageView.animationRepeatCount=5;
    [imageView startAnimating];
    
    [self addSubview:imageView];


    imageView.animationImages=images;
    imageView.animationRepeatCount=5;
    [imageView startAnimating];
依次放映数组中的图片

posted on 2014-05-23 15:27  超级庄子  阅读(119)  评论(0编辑  收藏  举报

导航