UIImageView动画显示

 

NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"myImage1.png"], [UIImage imageNamed:@"myImage2.png"], [UIImage imageNamed:@"myImage3.png"],  [UIImage imageNamed:@"myImage4.gif"], nil];

UIImageView *myAnimatedView = [[UIImageView alloc] initWithFrame:[self bounds]];

myAnimatedView.animationImages = myImages; //animationImages属性返回一个存放动画图片的数组

myAnimatedView.animationDuration = 0.25; //浏览整个图片一次所用的时间

myAnimatedView.animationRepeatCount = 0; // 0 = loops forever 动画重复次数

[myAnimatedView startAnimating];

[self addSubview:myAnimatedView];

[myAnimatedView release];

[pool drain];

 

你可能感兴趣的:(iOS经验之谈)