0

I have 61 images for animate the imageview. Iphone4 it crash due to memory problem.. Some time animation slow and the animation progress not linear.

for (int i = 1; i <= 61; i++)
        [images addObject:[UIImage imageNamed:[NSString stringWithFormat:@"%d.png", i]]];

lImageView.animationImages = images;
lImageView.animationDuration = 4.0f;
[lImageView startAnimating];

This is my code.. How to show like gif images in linear manner. I search lot most of them post this only.

for (int i = 1; i <= 61; i++) [images addObject:[UIImage imageNamed:[NSString stringWithFormat:@"%d.png", i]]];

CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"contents"];
animation.calculationMode = kCAAnimationDiscrete;
animation.duration = images.count / 24.0f;
animation.values = images;
animation.repeatCount = 1;
animation.delegate = self;
[lImageView.layer addAnimation:animation forKey:@"animation"];

Below code crash due to nil in array. That is imageWithContentsOfFile: this i didnt got the image.

for (int i = 1; i <= 61; i++)
            [images addObject: [UIImage imageWithContentsOfFile:[NSBundle mainBundle]pathForResource:imagename ofType:@".png"]]];

    lImageView.animationImages = images;
    lImageView.animationDuration = 4.0f;
    [lImageView startAnimating];

I tried this also this not start animation.. I didn't see any animation in above.. Any help Highly appreciable.

Thanks in advance

TamilKing
  • 1,643
  • 1
  • 12
  • 23

0 Answers0