Note that there are some explanatory texts on larger screens.

plurals
  1. POErasing on UIImageView
    primarykey
    data
    text
    <p>How can I erase content on front UIImage by swiping finger on it and display UIImage that is back side of UIView.</p> <p>I had used following code in <code>- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event</code> to erase front image:</p> <pre><code>-(void)eraseDrawingContents { UIGraphicsBeginImageContext(frontImage.frame.size); [frontImage.image drawInRect:CGRectMake(0, 0, frontImage.frame.size.width, frontImage.frame.size.height)]; CGContextSaveGState(UIGraphicsGetCurrentContext()); CGContextSetShouldAntialias(UIGraphicsGetCurrentContext(), YES); CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 25.0); CGContextSetShadowWithColor(UIGraphicsGetCurrentContext(), CGSizeMake(0, 0), 50, [[UIColor whiteColor]CGColor]); CGMutablePathRef path = CGPathCreateMutable(); CGPathMoveToPoint(path, nil, lastPoint.x, lastPoint.y); CGPathAddLineToPoint(path, nil, currentPoint.x, currentPoint.y); CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeClear); CGContextAddPath(UIGraphicsGetCurrentContext(), path); CGContextStrokePath(UIGraphicsGetCurrentContext()); frontImage.image = UIGraphicsGetImageFromCurrentImageContext(); CGContextRestoreGState(UIGraphicsGetCurrentContext()); UIGraphicsEndImageContext(); lastPoint = currentPoint; } </code></pre> <p>I achieved following output.</p> <p><img src="https://i.stack.imgur.com/jZN85.png" alt="enter image description here"> </p> <p>But I need output like this.</p> <p><img src="https://i.stack.imgur.com/F0kEB.png" alt="enter image description here"></p> <p>How can we achieve this functionality?</p> <p>Please help me.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload