Having a smooth uibezierpath how can i daw a uiimage every X distance? I need to converte a uibezierpath (with multiple quadcurved) into a nsmutablearray of linear spaced points.. any help?
Asked
Active
Viewed 249 times
2
-
If you have a given distance and want to space a specific number of items equidistantly, you'll want to use Linear Interpoloation. – Marcus Adams Jul 25 '13 at 20:40
-
Very interesting question. It reminds me of an old WWDC demo but I think they used some of the layout stuff that isn't available on iOS IIRC. Maybe you could do it with a collection view? Otherwise I think maybe you could do something with a replicator layer and a position animation along a path with speed=0 and individual delays. – David Rönnqvist Jul 25 '13 at 20:40
-
Does the path only contain *one* quad curve? If so then my previous wild ideas are crazy overkill :D – David Rönnqvist Jul 25 '13 at 20:43
-
You can extract the points and control points from a path using `CGPathApply()` but you will still have to do some work to turn the curves into lines and some more work to get all the points evenly distributed. Still it's less work than reimplementing all of UIBezierPath – David Rönnqvist Jul 25 '13 at 20:54
-
(Not a solution, just brainstorming): How about using CAShapeLayer and setting strokeEnd to fractional values. As in: http://oleb.net/blog/2010/12/animating-drawing-of-cgpath-with-cashapelayer/. I know this example does something different... but the idea of using strokeEnd property could be useful here. – Sanjay Chaudhry Jul 25 '13 at 21:04
-
Thanks rob mayoff, it was that i was looking for! This question is answered! – Jul 26 '13 at 09:01