1
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

UITouch *touch = [touches anyObject];

CGPoint currentPoint = [touch locationInView:self.view];

NSLog("%f  %f",currentPoint.x,currentPoint.y);
}

i want to developed a paint app for my ipad. when i use these code and use finger to paint a line on my pad, it's print (x,1),(x,3),(x,6),(x,7),(x,12),(x,15),(x,18)....

in my thought,it should print (x,1),(x,2),(x,3),(x,4),(x,5),(x,6),(x,7),(x,8),(x,9),(x,10),(x,11),(x,12),(x,13),(x,14),(x,15),(x,16),(x,17),(x,18)....

touchesMoved can not get continued coordinate ?

wendli
  • 11
  • 1

1 Answers1

2

It depends on the speed that you swipe. If you swipe really slow you'll probably get (x,1),(x,2),(x,3),(x,4),(x,5),(x,6),(x,7),(x,8),(x,9),(x,10), but if you swipe fast you can get as little as (x,1),(x,5),(x,10).

If you are developing a paint app you will have to take into account if the user hasn't lift his finger and paint the line between the points if he hasn't.

Good luck!

Zalykr
  • 1,524
  • 1
  • 10
  • 20
  • if i get (1,1),(10,5),(1,10),the line i paint on the screen doesn't look smart.user maybe want to paint a arc,but i draw a line on the screen. – wendli Mar 28 '12 at 13:33
  • Don't forget that this numbers are pixels, if you swipe fast you might skip some but not enough to make an arc look like a line. You can check the iphone app "Handwritting" (also runs on ipad and it's free) and see the effect that occurs when you swipe really fast. – Zalykr Mar 28 '12 at 13:54