UIImageView 动画

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
   
   
    //显示图片的UIImageView
    UIImageView *imageview=[[UIImageView alloc]initWithFrame:CGRectMake(50, 100, 200, 200)];
    imageview.backgroundColor=[UIColor redColor];
    [self.view addSubview:imageview];
   
    //动画的实现
    NSMutableArray * images = [NSMutableArray arrayWithCapacity:6];
    for (int i = 1; i <= 6; i++)
    {
        NSString * imageName = [NSString stringWithFormat:@"%d.jpg",i];
        UIImage * image = [UIImage imageNamed:imageName];
       
        [images addObject:image];
    }
    imageview.animationImages = images;
    imageview.animationDuration = 0.3;
    [imageview startAnimating];

}

posted @ 2014-12-02 14:44  銱ル╬鎯噹  阅读(100)  评论(0编辑  收藏  举报