Reputation: 59
What is the best method for setting a tap gesture recogniser to a line drawn by a user?
Currently I am drawing the line with a UIBezierPath using
[bpath addLineToPoint:touchPoint];
in the drawRect
method.
The issue I have is the line isn't a complete shape and so don't have a view to attach the gesture to.
Upvotes: 0
Views: 28
Reputation: 535304
The view whose drawRect
you are using is a view that you can attach the gesture recognizer to. And you know where the line is, because you have the bezier path that you used to draw it in the first place. So you can detect the tap and look to see whether it's effectively a touch on the line.
Upvotes: 1