Hello,
I have started learning about animating images and have a question regarding UIImageView class. I am trying to animate 2 images (png) to fall down from the top of the screen to the middle one after another and placed side by side on the x-axis. Example, image 1 is animated to move to co-ordinate x,y. Once that is done, image 2 is animated to move to it's coordinates
However, the following code animates both of them at the same time instead of animating image 1 falling into place and then image 2 falling into place:
Code:
for (UIImageView *imageToDisplay in imageArray) {
[imageToDisplay setFrame:CGRectMake(startXPos, 0, imageToDisplay.image.size.width, imageToDisplay.image.size.height)];
[UIView beginAnimations:nil context:nil]; // begin the animation block
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:0.55]; // set the animation length
[UIView setAnimationRepeatCount:0];
[self.view addSubview:imageToDisplay];
[imageToDisplay setFrame:CGRectMake(startXPos, yPos, imageToDisplay.image.size.width, imageToDisplay.image.size.height)];
startXPos+=xIncrement;
[UIView commitAnimations]; // end the animation block
}
I'm still learning and would appreciate any feedback.
Cheers!