views:

160

answers:

2

I have two points (x1, y1) A & (x2, y2) B.

I want to animate an image from point A to point B but also have a touch event on that image. What is the best way to accomplish this?

I am currently using CGPointMake to manually plot points but I want to be able to just plug in the two coordinates and have a timer loop to move the object.

I have this so far but it doesn't seem to work.

CGFloat xStep = x1;

xStep++;

CGFloat yStep = (((y2-y1)/(x2-x1))*xStep)+(((y2-y1)/(x2-x1))*x1);

+1  A: 

i think you're going about it too low level. what about doing things like:

http://stackoverflow.com/questions/1337288/how-does-uiview-beginanimations-work

Shnitzel
A: 

@Shnitzel. Can you do a touch event or stop the animation once the animation starts? If not, then i cannot use the method you suggested. If so, please explain how i can stop or add a touch event mid animation.

Thanks

ceuyan