How to fill a shape defined with CGPoints with gradient in iOS?

前端 未结 1 437
心在旅途
心在旅途 2021-01-22 10:59

I have a custom shape of an arrow set up in code. What I\'m trying to do is fill it with gradient. Problem is, I have no idea how to fill a non rectangular shape (space inside d

1条回答
  •  北恋
    北恋 (楼主)
    2021-01-22 11:22

    Check out this apple sample application. It has exactly what u need in the "Polygons" section (for filling a polygon). What you need to change is drawing the gradient instead of drawing as in the example. Drawing gradients is also exemplified in the sample, under the "Gradients" section.

    http://developer.apple.com/library/ios/#samplecode/QuartzDemo/Introduction/Intro.html

    Hope this helps, Vlad

    0 讨论(0)
提交回复
热议问题