Iphone 如何判断iOS中的简单png动画何时完成?

Iphone 如何判断iOS中的简单png动画何时完成?,iphone,ios,ipad,uiimageview,Iphone,Ios,Ipad,Uiimageview,这是经典的动画,但我需要知道它何时真正结束。谢谢 UIImageView* campFireView = [[UIImageView alloc] initWithFrame:self.view.frame]; campFireView.frame = CGRectMake(255.0f,0.0f,512.0f,384.0f); campFireView.animationImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"w

这是经典的动画,但我需要知道它何时真正结束。谢谢

UIImageView* campFireView = [[UIImageView alloc] initWithFrame:self.view.frame];
campFireView.frame = CGRectMake(255.0f,0.0f,512.0f,384.0f);

campFireView.animationImages = [NSArray arrayWithObjects:
  [UIImage imageNamed:@"wish_launch_up_low_00000.png"],
  [UIImage imageNamed:@"wish_launch_up_low_00001.png"],
  [UIImage imageNamed:@"wish_launch_up_low_00002.png"],
  [UIImage imageNamed:@"wish_launch_up_low_00003.png"],
  [UIImage imageNamed:@"wish_launch_up_low_00004.png"],
  [UIImage imageNamed:@"wish_launch_up_low_00005.png"],
  ,nil];


  campFireView.animationDuration = 0;
  campFireView.animationRepeatCount = 1;

  [campFireView startAnimating];

  [self.view addSubview:campFireView];

检测UIImageView动画很痛苦。。但是如果你不介意混乱的话,你可以这样做

UIImageView* campFireView = [[UIImageView alloc] initWithFrame:self.view.frame];
campFireView.frame = CGRectMake(255.0f,0.0f,512.0f,384.0f);

campFireView.animationImages = [NSArray arrayWithObjects:
  [UIImage imageNamed:@"wish_launch_up_low_00000.png"],
  [UIImage imageNamed:@"wish_launch_up_low_00001.png"],
  [UIImage imageNamed:@"wish_launch_up_low_00002.png"],
  [UIImage imageNamed:@"wish_launch_up_low_00003.png"],
  [UIImage imageNamed:@"wish_launch_up_low_00004.png"],
  [UIImage imageNamed:@"wish_launch_up_low_00005.png"],
  ,nil];


  campFireView.animationDuration = 4;  // <--- I changed the duration.. 
  campFireView.animationRepeatCount = 1;

  [campFireView startAnimating];

  [self.view addSubview:campFireView];
这只是一个例子,但如果您的动画持续时间小于计时器,您可以使用计时器检查它以验证是否动画化


但是,在UIImageView中有许多选项可以设置其他动画…

谢谢。跳到OpneGL中准备下一个动画。这肯定是一个聪明的黑客。
  // detect it with timer
  [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(onTimer) userInfo:nil repeats:YES];

-(void)OnTimer {
    if ( [campFireView isAnimating] )
    {
        // still animating
    }
    else
    {
        // Animating done
    }

}