天天看點

擦除ImageView的圓形橡皮擦

View Code

1         CGPoint currentPoint = [touch locationInView:imageView];
 2         UIGraphicsBeginImageContext(self.imageView.frame.size);
 3         [imageView.image drawInRect:imageView.bounds];
 4         
 5         CGContextRef context = UIGraphicsGetCurrentContext(); 
 6         CGRect cirleRect = CGRectMake(currentPoint.x-30, currentPoint.y-30,60, 60); 
 7 
 8         CGContextAddArc(context,currentPoint.x, currentPoint.y,30, 0, 2*M_PI, 0);
 9         CGContextClip(context); 
10         CGContextClearRect(context,cirleRect);
11           imageView.image=UIGraphicsGetImageFromCurrentImageContext(); 
12         UIGraphicsEndImageContext();      

轉載于:https://www.cnblogs.com/iosNoteBook/archive/2012/04/17/2454175.html