2011-03-28 102 views

回答

7

这可以使用UIImageView来完成(如果你喜欢,你可以创建一个自定义的UIView子类)。基本代码是这样的:

UIImageView* animatedImageView = [[UIImageView alloc] initWithFrame:self.view.frame]; 

animatedImageView.animationImages = [NSArray arrayWithObjects:  
          [UIImage imageNamed:@"spinner-01.png"], 
          [UIImage imageNamed:@"spinner-02.png"], 
          [UIImage imageNamed:@"spinner-03.png"], 
          [UIImage imageNamed:@"spinner-04.png"], 
          nil]; 

animatedImageView.animationDuration = 1.0; 
animatedImageView.animationRepeatCount = 0; 

[animatedImageView startAnimating];