Right now I'm able to do a simple animation using the code below. However, the below solution needs me to predefine the image names. How can I do something like NSArray.push("image1.png"); for example? Then assign the dynamic array as the animationImages?
Thank you, Tee
UIImageView* animationView = [[UIImageView alloc] initWithFrame:self.view.frame];
animationView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"transition 1.png"],
[UIImage imageNamed:@"transition 2.png"],
[UIImage imageNamed:@"transition 3.png"],
[UIImage imageNamed:@"transition 4.png"],
[UIImage imageNamed:@"transition 5.png"], nil];
You can use
NSMutableArray
, and add objects to it usingaddObject:
. For example:}
That's the way I animate images. Just call animate wherever and it'll do its stuff
@pgb, thank you your snippet works. I was using [[NSMutableArray alloc] init] instead of [NSMutableArray array] and that seems to be the issue.
Thanks, Tee