如何在iPhone SDK中使用手势在屏幕上绘图?

问题描述:

我想通过在屏幕上移动手指在屏幕上绘图。如何在iPhone SDK中使用手势在屏幕上绘图?

我们如何在iPhone SDK中实现这一点?

您首先需要实现来自UIResponder链的触摸感应方法。你需要实现的方法有:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 

在这个方法里面你可以使用Core Graphics绘图方法绘制自定义绘图。 This教程将引导您完成步骤。