3

I am using an animated UIImage, and would like it to stop after repeating once. So logically, I use the animationRepeatCounter property. However, when the property is set to anything besides 0, the image doesn't ever appear!

NSMutableArray * imageArray = [NSMutableArray arrayWithCapacity:85];
for (int i = 1; i<86; i++)
{
    NSString *imagename = [NSString stringWithFormat:@"animation_image_%d.png", i];
    UIImage *tempImage = [UIImage imageNamed:imagename];
    [imageArray addObject:tempImage];
}
self.setupAnimation.animationImages = imageArray;
self.setupAnimation.animationDuration = 3.0;
self.setupAnimation.animationRepeatCount = 1;
[self.setupAnimation startAnimating];
}

If animationRepeatCount is set to 0, all works well (I see the image animating indefinitely). When it is set to any other number, it doesn't appear. 'self.setupAnimation' is:

@property (retain, nonatomic) IBOutlet UIImageView *setupAnimation;

Any ideas why this would happen?

Tulon
  • 4,011
  • 6
  • 36
  • 56
maxfron
  • 31
  • 2
  • When is this animation started ? Are you sure the view is visible at the moment you start it ? – Emilie May 21 '14 at 18:55
  • You're code worked fine for me. – rdelmar May 21 '14 at 20:06
  • I do believe this is the 'correct' code, as I use it elsewhere to accomplish this. I'm looking for advice on what could cause an issue like this - something to do with Interface Builder? – maxfron May 21 '14 at 22:00
  • And yes, the view is visible, which I have confirmed since the animation works perfectly fine with animationRepeatCount = 0 – maxfron May 21 '14 at 22:01
  • Did you ever find a solution to this? I'm seeing the same issue, but no solutions – Keith Jan 29 '16 at 14:34
  • did you solve this, I am having the same problem https://stackoverflow.com/questions/60766734/animation-not-playing-inside-speech-synthesizer-delegate?noredirect=1#comment107525325_60766734 – JRowan Mar 20 '20 at 16:55

0 Answers0