【发布时间】:2011-04-29 09:09:16
【问题描述】:
我想通过在屏幕上移动手指来在屏幕上绘图。
我们如何在 iPhone SDK 中实现这一点?
【问题讨论】:
标签: ios cocoa-touch ios4 uitouch custom-draw
我想通过在屏幕上移动手指来在屏幕上绘图。
我们如何在 iPhone SDK 中实现这一点?
【问题讨论】:
标签: ios cocoa-touch ios4 uitouch custom-draw
您首先需要实现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 教程将引导您完成这些步骤。
【讨论】: