Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Unerase the erased UIImage
    primarykey
    data
    text
    <p>Hi Guys I am trying a Image erasing code in my PanGesture I am using code below:</p> <pre><code> UIImage * image = [UIImage imageNamed:@"326d4fb72362a2e44659141cadfc4977.jpg"]; holderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 235)]; imgForeground = [[UIImageView alloc] initWithFrame:[holderView frame]]; [imgForeground setImage:image]; [holderView addSubview:imgForeground]; UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(move:)]; [panRecognizer setMinimumNumberOfTouches:1]; [panRecognizer setMaximumNumberOfTouches:1]; [panRecognizer setDelegate:self]; [holderView addGestureRecognizer:panRecognizer]; [self.view addSubview:holderView]; </code></pre> <p>Then I am handling this here</p> <pre><code> -(void)move:(id)sender { CGPoint currentPoint; if([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateBegan){ lastPoint = [sender locationInView:imgForeground]; lastPoint.y -=20; } else{ currentPoint = [sender locationInView:imgForeground];; currentPoint.y -=20; } UIGraphicsBeginImageContext(imgForeground.frame.size); [imgForeground.image drawInRect:CGRectMake(imgForeground.frame.origin.x, imgForeground.frame.origin.y, imgForeground.frame.size.width, imgForeground.frame.size.height)]; CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineCap(context,kCGLineCapRound); //kCGImageAlphaPremultipliedLast); CGContextSetLineWidth(context, 10); CGContextSetRGBStrokeColor(context, 0, 0, 0, 1.0); CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeClear); CGContextBeginPath(context); CGContextMoveToPoint(context, lastPoint.x, lastPoint.y); CGContextAddLineToPoint(context, lastPoint.x, lastPoint.y); CGContextStrokePath(context); imgForeground.image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); } </code></pre> <p><strong>My Question is How to Unerase the same Image Please Help</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    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