I want to do some custom drawing with CoreGraphics. I need a linear gradient on my view, but the thing is that this view is a rounded rectangle so I want my gradient to be also rounded at angles. You can see what I want to achieve on the image below:

So is this possible to implement in CoreGraphics or some other programmatic and easy way?
Thank you.
I don’t think there is an API for that, but you can get the same effect if you first draw a radial gradient, say, in an
(N+1)x(N+1)size bitmap context, then convert the image from the context to a resizable image with left and right caps set toN.Pseudocode:
In case you want the image to scale vertically as well, you just have to set the caps to
UIEdgeInsetsMake(N,N,N,N).