Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在视图内的封闭路径上绘制 CGGradient?我试图绘制渐变,但是,它是在视图本身上绘制的,而不是仅在我在视图内填充的 CGPath 内。我只想在填充路径上绘制渐变,而不是在视图本身上。
例子:
CGContextSaveGState(context); CGContextAddPath(context, myPath); CGContextClip(context); CGContextDrawLinearGradient(context, gradient, startPoint, endPoint, kNilOptions); CGContextRestoreGState(context);