iPhone开发基础之动画显示图片的实现

  本文介绍一种动态显示多张图片效果的方法, 示例代码和说明如下

 

 

//初始化UIImageview UIImageView* animview=[[[UIImageView alloc] initWithFrame:self.view.frame]autorelease]; //加入图片资源 animview.animationImages=[NSArray arrayWithObjects: [UIImage imageNamed:@"apple.jpg"], [UIImage imageNamed:@"pic0.jpg"], [UIImage imageNamed:@"pic1.jpg"], nil]; //一个循环下来的时间设置为3s, 缺省是每张图片1/30s animview.animationDuration=3; //一直循环,缺省就是这个值 animview.animationRepeatCount=0; //开始动画显示 [animview startAnimating]; [self.view addSubview:animview];  

你可能感兴趣的:(iPhone开发基础之动画显示图片的实现)