技术开发 频道

新手必读:iPhone SDK示例代码解析

  Animation: 一组图片

  连续的显示一组图片

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];
[myAnimatedView initWithFrame:[self bounds]];
myAnimatedView.animationImages
= myImages;
myAnimatedView.animationDuration
= 0.25; // seconds
myAnimatedView.animationRepeatCount
= 0; // 0 = loops forever
[myAnimatedView startAnimating];
[self addSubview:myAnimatedView];
[myAnimatedView release];
0
相关文章