Search code examples
ioscocoadrawinguigesturerecognizeruitouch

UIGestureRecognizer vs. UITouch Delegate Performance


I am writing an app for drawing. My main question is: How do I get the best performance from touch events?

Is there a difference between UIGestureRecognizer and UITouch Delegates? Are there different refresh rates or sth.?

Best Philipp


Solution

  • For a drawing app you should use UITouch delegates because it will be faster then other UIGestureRecognizer. The reason is whenever a tap event occurs in that case the UIEvent of tap action is traversed thorough the UIResponder chain and transmitted to the UIResponder which is responding to the tapped event. So if you'll add a UIGesture on top of a view then there will be an extra machine cycle to check the UIGesture in responder chain which is not worthy for a drawing apps cause these apps should be much faster in responding to taps.

    All you need is to set the userInteractionEnabled property of the view where you want to draw.