核心动画还是OpenGL ES? [英] Core Animation or OpenGL ES?
问题描述
我要执行以下操作:
点击屏幕,在抽点处绘制3个小指。
我从哪里开始?
如上所述,Core Graphics框架可能是你想要的。一个好的方法是将UIView子类化,然后覆盖两个方法 drawRect:
和 touchesEnded:withEvent:
。
当触摸事件在UIView上结束时,可以将事件最后一次触摸的点传递给 然后,在你的实现 I want to do the following: Tap the screen and draw 3 cricles around the the tapped point.
Is it better to do this with Core Animation or OpenGL ES? Where do I start? As mentioned, the Core Graphics framework is probably what you want. A good way to go about it would be to subclass UIView, then override the two methods When a touch event ends on the UIView, you can get the point of the last touch from the event passed to Then, in your implementation of 这篇关于核心动画还是OpenGL ES?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! touchesEnded:withEvent:
drawRect:/ code>,你将得到存储的最后一个触摸点,并使用对
CGContextAddEllipseInRect
的三次调用绘制三个圆圈,如下所述: Quartz 2D编程指南:路径(注册为Apple需要开发人员)。drawRect:
and touchesEnded:withEvent:
.touchesEnded:withEvent:
, and store it somehow in the instance of your subclassed UIView.drawRect:
, you'll get the stored last touch point, and draw three circles around it using three calls to CGContextAddEllipseInRect
, as discussed here: Quartz 2D Programming Guide: Paths (registration as Apple Developer required).