UIImageView *_dogImageView = [[UIImageView alloc] init];

_dogImageView.frame = CGRectMake(0, 100, 300, 200);

[self.view addSubview:_dogImageView];

 

NSMutableArray* imageArray = [[NSMutableArray alloc] init];

for (int i = 1; i <= 20; ++i)
{
    NSString* iname = [NSString stringWithFormat:@"dog_%d", i];
    UIImage* image = [UIImage imageNamed:iname];
    [imageArray addObject:image];
}

_dogImageView.animationImages = imageArray; //动画图片数组

_dogImageView.animationDuration = 2.5; //执行一次完整动画所需的时长

_dogImageView.animationRepeatCount = 0; // 执行一次, 然后自动消失

[_dogImageView startAnimating];

 

posted on 2014-08-07 17:20  童话DY  阅读(123)  评论(0编辑  收藏  举报