擦除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();

posted on 2012-04-17 19:25  AXZON  阅读(299)  评论(0编辑  收藏  举报

导航