I am developing an app in which user draws lines with finger touch or simply sprays colors. I am using UIBezierPath to paint the path (colors) on finger touch in drawRect method with following code.
CGContextRef context = UIGraphicsGetCurrentContext();
for (BezierPath *path in paths)
{
path.path.lineWidth = [DataController dataController].apertureRadius * 2;
path.path.lineJoinStyle = kCGLineJoinRound;
path.path.lineCapStyle = kCGLineCapRound;
///
[path.color set];
CGContextSetShadowWithColor(context, CGSizeMake(0, 0), 20, [path.color CGColor]);//Problem
//
[path.path stroke];
}
This code works perfect on simulator but on Device the spray is really slow. and the problem is only with method call CGContextSetShadowWithColor, if I comment this line performance is best with no problem at all.
Please suggest me why this is so and what should I do. This line is necessary as I want to show the spray like effect with Blurry shadow.