I’m try to dynamically create puzzle piece, and it looks like this:

I want to fill this shape with some color so it will looks like this:

so I can use it for masking some image.
PROBLEM:
I creating this shape with 4 UIBezierPath, then convert it to 1 path using appendPath.
I want to fill this path but when I use fill I got this:

Do you have any ideas how I can fill same shapes?
I’m try to dynamically create puzzle piece, and it looks like this: I want
Share
After some time I found a reason why I got these results.
If you want to create some path for filling you should not use
moveToPointmethod, instead you should just once set first point usingmoveToPointand then draw all lines withaddLineToPoint,addCurveToPoint, etc.After you complete draw your path do not forget send
closePathmessage.Before I knew this, I drew every side of puzzle piece using different UIBezierPath instances and for every path I set first point using
moveToPoint.