Animating UIImage in UIImageView in iPhone and iPad Development

// create the uiimageview that will execute our animation
UIImageView* imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,480)];

// load all the frames of our animation
imageView .animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@”image1.jpg”],
[UIImage imageNamed:@”image2.jpg”],
[UIImage imageNamed:@”image3.gif”],

// all frames will execute in 1.75 seconds
imageView .animationDuration = 1.75;
// repeat the annimation forever
imageView .animationRepeatCount = 0;
// start animating
[imageView  startAnimating];
// add the animation view to the main window
[self.view addSubview:imageView ];

/// To Stop animation
[imageView stopAnimating];



Leave a Reply

Your email address will not be published. Required fields are marked *