I’m currently drawing on the screen. I get smooth lines, I can change the color of my drawings. But I can’t find how to apply a shadow to that line.
To draw it, I use :
[path strokeWithBlendMode:[path blendMode] alpha:1.0];
I saw that I could use CGContextSetShadowWithColor() but even though, I’m not sure how to use it since here’s what’s said in the CGPath reference for strokeWithBlendMode:
This method automatically saves the current graphics state prior to
drawing and restores that state when it is done, so you do not have to
save the graphics state yourself.
So I don’t really know where to put that CGContextSetShadowWithColor() or anything else if I can use it.
Regards
If you want to use
CGContextSetShadowwithColor()then you will need to change the way to draw your bezierpath to the view so that you draw theCGPathrepresentation to theCGContext. An example is below:Another way you could do this is to create a new
CAShapeLayerand draw you path to that by setting it as the path property. This will easily allow you to add a shadow that will only shadow your path.