-1
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]];

}

}
4

1 に答える 1

0

これを試して..

 [_playerImageView setImage:_imageData[1]];  // Set the Image for PlayerImageView
 [_playerImageView startAnimating];          // It will start animating

最初に画像を設定してからアニメーションを開始するの説明を最初にアニメーション化してから画像を設定します

 this [_playerImageView setImage:_imageData[1]] //This will set image from the array objectAtIndex 1.
于 2013-09-20T13:37:13.723 に答える