-3

Can anyone give me an example of code or project that uses because I want to animate a full screen image(iPhone) with 200+ of images without crashing the device.

+ (UIImage *)animatedImageNamed:(NSString *)name duration:(NSTimeInterval)duration

Also on how to call it for example like [self (method)] and regarding on how to stop the animation on it. Because when I read it in the apple documentation, I am having a hard time because I don't see a sample code regarding to that syntax. By the way, I am a trainee at iOS development.

Farouk Touzi
  • 3,451
  • 2
  • 19
  • 25

2 Answers2

1

In the method signature you can see the + sign showing that is not an instance but a class method (see the difference). In order to call it you use

UIImage * myAnimatedImage = [UIImage animatedImageNamed:@"Imagename.png" duration:12.0f];
myImageView.image = myAnimatedImage; // the same as [myImageView setImage:myAnimatedImage];
Community
  • 1
  • 1
A-Live
  • 8,904
  • 2
  • 39
  • 74
1

Two hundred full screen images take a lot of memory. You should convert your images to a video file instead and use an AVPlayerLayer to play it. You will need to read the Playback section of the AV Foundation Programming Guide.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848