Given an arbitrary UIBezierPath, I'm looking for a way to get a point at a fraction of the length of that path.
Example:
UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(200.0, 200.0)];
[path addLineToPoint:CGPointMake(200.0, 400.0)];
CGPoint p = [path pointAtFraction:0.5];
p should be {x: 200.0, y: 300.0} in this case.
I'm aware that this simple example could be calculated, but I'm looking for a solution that fits ANY UIBezierPath (arcs, rounded rects, etc.)
Seeing CAShapeLayer, which basically lives off UIBezierPath, and its property strokeEnd, I suppose the information is somewhere inside the path object. However, neither UIBezierPath nor CGPathRef interfaces show any way to achieve this.
I tried creating a CAShapeLayer, setting the strokeEnd and retrieving the CGPathRef from the layer, but the path stays the same.
Is there any way (public API) to achieve this ?