Confused
Confused

Reputation: 6278

Edit a CGPath's "vertices"?

If a triangle is created in a CGPath, and I desire to move one of the corners of the triangle relative to the other two corners, it seems I need to create a new CGPath...

That doesn't seem right.

Is there a way to simply edit the position of a corner of that triangle within an existing CGPath?

Upvotes: 1

Views: 479

Answers (1)

Henri Normak
Henri Normak

Reputation: 4725

There is an API for iterating over all elements in the CGPath, called CGPathApply(), however, you would need to create a new mutable path in order to change the existing path.

In short, as you can iterate over the various elements of the path, you can modify them before adding them to a new mutable path, which once completed will resemble the original, but with the changes you made in CGPathApply().

EDIT: In short, no, you can't edit elements of an existing CGPath, you can only copy them over (potentially modifying them during the copy) to a new path.

Upvotes: 1

Related Questions