about two questions
/*
1.这个[_playerImageView setImage:_imageData[1]]
what can it do ? why ?
2. [_playerImageView startAnimating] 和 [_playerImageView setImage:_imageData[1]] 的序列如何影响结果 */
- (void)loadDataAndAnimation
{
_imageData =@[[UIImage imageNamed:@"a"],
[UIImage imageNamed:@"b"],
[UIImage imageNamed:@"c"]];
[_playerImageView setAnimationImages:self.imageData];
[_playerImageView setAnimationDuration:5.0];
[_playerImageView startAnimating];
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self loadDataAndAnimation];
}
- (IBAction)playGame:(UIButton *)sender
{
NSLog(@"%d",sender.tag);
if ([_playerImageView isAnimating])
{
NSLog(@"stop");
[_playerImageView stopAnimating];
[_playerImageView setImage:_imageData[sender.tag]];
}else
{
NSLog(@"start");
[_playerImageView startAnimating];
// something wrong ?
[_playerImageView setImage:_imageData[1]];
}
}