自己看的文章

2021-11-09 擦除ImageView的圆形橡皮擦

2021-11-10  本文已影响0人  cc帅气的昵称

CGPoint currentPoint = [touch locationInView:imageView]; 

 UIGraphicsBeginImageContext(self.imageView.frame.size); 

 [imageView.image drawInRect:imageView.bounds]; 4 

 CGContextRef context = UIGraphicsGetCurrentContext(); 

 CGRect cirleRect = CGRectMake(currentPoint.x-30, currentPoint.y-30,60,60); 

CGContextAddArc(context,currentPoint.x, currentPoint.y,30,0,2*M_PI,0); 

 CGContextClip(context); 

 CGContextClearRect(context,cirleRect);

imageView.image=UIGraphicsGetImageFromCurrentImageContext(); 

UIGraphicsEndImageContext();

上一篇 下一篇

猜你喜欢

热点阅读