Moving 2 images sequentially across the screen in IOS

144 views Asked by At

I have several images that I want to move sequentially, across the screen, each with a specific delay. I have animated the first image like this:

[UIView animateWithDuration:0.5f
        animations:^{
            image1.center = CGPointMake(image1.center.x + 10.0f, image1.center.y);

                 }
 completion:nil];

Now I want to move image2 behind image 1. Do I have to add a delay for image2? I mean, I want image2 to follow image1 in moving across the screen. How do I do this?

P.S: The above code moves image1 from left to right, across the screen.

1

There are 1 answers

0
rdelmar On BEST ANSWER

Put the animation method ( animateWithDuration:delay:options:animations:completion:) in the completion block of the first animation. Add whatever delay you want (the delay will be between the end of the first animation and the start of the second).