Domanda

I have two UIViews, each one has draw a car(vectorgraph), now if a car(A) behind another car(B), then I want the overlaps in A be dashed. the car was drawn by UIBezierPath, I want the overlaps in A's path become dashed, how can I do this? Thank you for your helping!

È stato utile?

Soluzione

I don't think there is any way to do this automatically. You would need to calculate the bounding rectangle of the intersection of the 2 views, and then manually parse the path of car A into 2 parts, the part that's covered and the part that's not, and draw the covered part using dashed lines.

This is original development that you would have to do yourself.

Erica Sadun's outstanding "iOS Developer's Cookbook" series has a recipe that shows how to parse a bezier path segment by segment. Figuring out the portion of the path that is inside the intersection range will involve some tricky programming.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top