1
- (IBAction)didTouchAnimate:(UIButton*)sender {

    UIImage *starImage = [UIImage imageNamed:@"star.png"];
    UIImageView *starView = [[UIImageView alloc] initWithImage:starImage];
    [starView setCenter:sender.center];

    [UIView animateWithDuration:1.50f delay:0.0f options:UIViewAnimationCurveEaseInOutanimations:^{
                         [starView setCenter:CGPointMake(+100, +100)];
                         [starView setAlpha:0.6f];
                     }
                     completion:^(BOOL finished){
                         [starView removeFromSuperview];
                         // points++;
                         // NSLog(@"points: %i", points);
                     }];

    [self.view addSubview:starView];
}

配列リストがあります。これらの画像をアニメーション化するにはどうすればよいですか。

Dollars.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"score_animate_0001.png"],
[UIImage imageNamed:@"score_animate_0002.png"],
[UIImage imageNamed:@"score_animate_0003.png"],
[UIImage imageNamed:@"score_animate_0004.png"],
[UIImage imageNamed:@"score_animate_0005.png"],
[UIImage imageNamed:@"score_animate_0006.png"],
[UIImage imageNamed:@"score_animate_0007.png"],nil];
4

4 に答える 4

1

使用する

- (IBAction)didTouchAnimate:(UIButton*)sender {

  UIImageView *animatingImageView = [[UIImageView alloc] initWithFrame:some.frame];
  animatingImageView.animationImages = Dollars.animationImages;
  animatingImageView.animationDuration = 10;
  [animatingImageView startAnimating];

or simply 
[animatingImageView animatedImagesWithImages:Dollars.animationImages duration:10]
}
于 2013-05-16T10:49:09.190 に答える