iosobjective-cpolygonmkpolygon

Multi Color Polygon in iOS


Hi I am trying to implement a polygon with a color gradient based on the color of each corner (the polygon is an overlay for a map). so for example this image would have a green point a red point and a blue point and the colors mix in the center. Up until now I have been using MKPolygon. Any Guidance will be appreciated.

Thanks,


Solution

  • To Achieve my result I wrote a for loop that iterated through all the points, which had a for loop inside that subtracted a value from the other points to make the polygon smaller and created a polygon this was done until the polygon was small enough for the view. This gave it a nice gradient and doing it for the other cornea with different colors gave the desired gradient of colors.