- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:self.view];
NSLog("%f %f",currentPoint.x,currentPoint.y);
}我想为我的ipad开发一个绘画应用程序。当我使用这些代码并用手指在我的本子上画一条线时,它是print (x,1),(x,3),(x,6),(x,7),(x,12),(x,15),(x,18)...
在我看来,它应该打印(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不能得到连续坐标吗?
发布于 2012-03-28 21:20:17
这取决于你刷卡的速度。如果你刷得很慢,你可能会得到(x,1),(x,2),(x,3),(x,4),(x,5),(x,6),(x,7),(x,8),(x,9),(x,10),但如果你刷得快,你可能会得到(x,1),(x,5),(x,10)。
如果你正在开发一个画图应用程序,你将不得不考虑如果用户没有举起他的手指,如果他没有画点之间的线,你将不得不考虑。
祝好运!
https://stackoverflow.com/questions/9908258
复制相似问题