【发布时间】:2011-07-23 11:31:48
【问题描述】:
我的应用程序允许用户在屏幕上拖动圆圈。我想知道是否有任何标准步骤可以实现这一点,特别是在将视图的正确区域标记为脏的方面。我目前正在做以下事情:
//Get initial touch point and draw a circle there. Use touch point and size of circle to pass the mark the appropriate CGRect as dirty so that it gets redrawn
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
//Get new touchpoint and draw a circle there. Use the union of the previous CGRect and the new one (based on the touch point and circle size) to tell drawRect: what area of the screen to redraw.
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
这看起来对吗,还是我应该做一些其他的基本工作?
【问题讨论】:
-
您是否打算添加更多代码?或者你只是说你实现了这些方法?
-
我不打算添加更多代码,因为我不担心实现的细节,只担心应该采取的更广泛的概念步骤。
标签: ios cocoa-touch drawing touch drawrect