UI_UIImageView

UIImageView用于显示图片的类

相当于一个相框,专门用作显示图片,可以存放一个图片或一组图片 

使用initWithImage:方法,创建UIImageView对象

使用initWithContentOfFile:方法,创建一个UIImage对象 

UIImageView常用属性

 1 {
 2 //设置图片
 3 image
 4 //设置一组动态图片
 5 animationImages
 6 //设置播放一次一组动态图片的时间
 7 animationDuration
 8 //设置重复次数
 9 animationRepeatCount
10 //开始动画
11 startAnimating
12 //结束动画
13 stopAnimating 

 1 @implementation ViewController
 2 
 3 - (void)viewDidLoad {
 4     [super viewDidLoad];
 5     NSMutableArray *imageArray = [NSMutableArray arrayWithCapacity:1];
 6     for (int i = 10; i < 10; i++) {
 7         NSString *fileName = [NSString stringWithFormat:@"lufei_%d.tiff",i];
 8         UIImage *aImage = [UIImage imageNamed:fileName];
 9         [imageArray addObject:aImage];
10     }
11     UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(2020280280)];
12     imageView.animationImages = imageArray;
13     [self.view addSubview:imageView];
14 //    降低播放速度默认时长1.0
15     imageView.animationDuration = 3.0;
16 //    开始播放动画
17     [imageView startAnimating];
18     // Do any additional setup after loading the view, typically from a nib.

19 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2015-04-11 19:30  captivity  阅读(76)  评论(0)    收藏  举报