I want to fill a polygon shape that I have drawn via Core Graphics with a linear CGGradient. The CGContextDrawLinearGradient function draws a gradient from one point to another but it fills the entire view. How can I display the gradient only inside the polygon shape I have drawn?
Share
You can construct a CGMutablePath in your desired shape then use it to clip to the region you want to display, something like…