I am trying to draw just a custom portion of a UIImage
(i.e.: I would like to reveal the portion of the UIImage
user touches) and I am hav
One thing you could try is simply clipping instead of creating an extra layer. e.g.
- (void)drawRect:(CGRect)rect
{
CGContextRef ctx = UIGraphicsGetCurrentContext();
UIBezierPath *maskPath = [UIBezierPath bezierPath];
[maskPath setLineWidth:10.0];
[maskPath moveToPoint:CGPointMake(10.0, 10.0)];
[maskPath addLineToPoint:CGPointMake(100.0, 100.0)];
CGContextAddPath(ctx, maskPath.CGPath);
CGContextClip(ctx)
[img drawInRect:rect];
}