I can draw a path and make the view drag-able via gesture recognizer. How would I make a point on the path drag-able. I suppose I would need to identify that point to check it’s location in the view and to reset it’s location to the point to which it is dragged, but that is what I am not sure how to do.
Share
Bro there are function for detecting a hit on
CGPathorUIBezierPath. ONtouchesBegan: method you can use either one of following methods to detect if the hit point is on the path or not.For
UIBezierPath:- (BOOL)containsPoint:(CGPoint)pointFor
GGPath:Then if this point is on your path then you can set a flag. and In
touchesEndmethod you can get the translated point. However need to redraw the path. Path will not be elastic.EDIT: One thing that my work for your case is
CAShapeLayer.CAShapeLayer can draw aUIBazierPathorCGPathRef. And also its animatable via its properties of strokeend and strokestart. See following code to get the idea of drawing a path withCAShapeLayer