Search code examples
iosuikitcore-graphicsshadowuibezierpath

UIBezierPath Shadow effect


Currently I am working on a paint app for iOS. I am stuck with applying shadow effect to a particular drawn path. I have use UIBezierpath to draw paths. Is there any way to apply shadow effect on UIBezierpath?


Solution

  • CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetStrokeColorWithColor(context, [[UIColor whiteColor] CGColor]);
    CGContextSetShadowWithColor(context, CGSizeMake(0, 5), 5.0, [[UIColor blackColor]CGColor]);
    CGContextDrawPath(context, kCGPathFill);
    

    Something like this may help u..