You should just use UIImageView
s animationImages
and animationDuration
properties to accomplish this swapping.
Your animationImages
array would be your two images and your animationDuration
would be 0.1
to show both over the span of 0.1 seconds. Then call startAnimating
to start the sequence
- (void)viewDidLoad
{
[super viewDidLoad];
UIImage *image1 = [UIImage imageNamed:@"image1"];
UIImage *image2 = [UIImage imageNamed:@"image2"];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 20.0f, 200.0f, 200.0f)];
[self.view addSubview:imageView];
imageView.animationImages = @[image1, image2];
imageView.animationDuration = 0.1;
[imageView startAnimating];
}