2011-03-28 141 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];