Change position of UIImageView when Animating in NSArray

93 views Asked by At

So I've seen a whole bunch of resources an answers to similar questions regarding how to change the position of a UIImageView, which can be done like this:

myUIImageView.center = CGPointMake(myImage_X, myImage_Y);

But I can not get this to work when I have my UIImageView animating.

I start my animation like this:

 myUIImageView.animationImages = [NSArray arrayWithObjects:
                        [UIImage imageNamed:@"img1.png"],
                        [UIImage imageNamed:@"img2.png"],
                        [UIImage imageNamed:@"img3.png"],nil];

[myUIImageView setAnimationRepeatCount:0];
myUIImageView.animationDuration = 1.0;
[myUIImageView startAnimating];

Then try to move it with the line of code above... which didn't work. Then I tried this after setting it as a property and synthesising it:

[myUIImageView setFrame:CGRectMake( 10, 
                                    10, 
                                    myUIImageView.frame.size.width,   
                                    myUIImageView.frame.size.height
                                  )];

But it doesn't move the image :(

Currently my image is animating on the spot. But I want it to initially change position (set the coords to top of the screen), then have it fall in the Y direction. Am I doing something silly?

0

There are 0 answers