2

I have a UIBezierPath.

I wish to get an array of all the points in the path.

Is that possible?

Thanks Shani

Devin
  • 7,573
  • 6
  • 37
  • 53
shannoga
  • 19,316
  • 20
  • 102
  • 165
  • There is a `UIBezierPath` and a `CGPath` but no `CGPath`. Please restate your question. – zaph Jan 29 '12 at 14:57
  • Possible duplicate of http://stackoverflow.com/questions/3051760/getting-a-list-of-points-from-a-uibezierpath – Devin Dec 10 '14 at 20:06

1 Answers1

2

Neither UIBezierPath nor CGPath have a method to obtain their points. This makes sense because the paths can be created with methods that are not simple points.

As @daveMac mentions in a comment there is a work-around:

void CGPathApply (
   CGPathRef path,
   void *info,
   CGPathApplierFunction function
);

For each element in the specified path, Quartz calls the applier function, which can examine (but not modify) the element.

zaph
  • 110,296
  • 20
  • 185
  • 221
  • 1
    What about CGPathApply? I do the very thing the OP is asking quite often when I need to dissect a path. – daveMac May 31 '12 at 23:57