I have a UIImageView that I am trying to make do an animation of a set of UIImages that are created by flipping other UIImages. Here's my code:
Problem is, when I try and make it animate from the array of flipped images, it shows the originals, not the flipped ones (i.e., when I do this):
Now, if I do this however:
the flipped image is shown. I thought maybe you can't do the animation with CGImage, but couldn't find that anyone else had had the same problem. Any ideas?
Thanks,
Sam
Code:
turtle = [[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width-200,
self.view.frame.size.height - sand.frame.size.height - turtle.frame.size.height - 10 - heightOfKeyboard,
100,100)];
[flippedTurtleArray addObject:[UIImage imageWithCGImage:[UIImage imageNamed:@"Turtle1.png"].CGImage scale:1 orientation:UIImageOrientationDownMirrored]];
[flippedTurtleArray addObject:[UIImage imageWithCGImage:[UIImage imageNamed:@"Turtle2.png"].CGImage scale:1 orientation:UIImageOrientationDownMirrored]];
[flippedTurtleArray addObject:[UIImage imageWithCGImage:[UIImage imageNamed:@"Turtle3.png"].CGImage scale:1 orientation:UIImageOrientationDownMirrored]];
[flippedTurtleArray addObject:[UIImage imageWithCGImage:[UIImage imageNamed:@"Turtle2.png"].CGImage scale:1 orientation:UIImageOrientationDownMirrored]];
[self.view addSubview: turtle];
Code:
turtle.animationImages = flippedTurtleArray;
turtle.animationDuration = 0.8f;
turtle.animationRepeatCount = 0;
[turtle startAnimating];
the original non flipped images are shown.
Code:
turtle.image = [flippedTurtleArray objectAtIndex:1];
Thanks,
Sam