思路:首先我的思路放两个imageView在Controller里把高清的图片放在下面,带有毛玻璃效果的图片放在上面。
//在Controller的view上加一个手势代码如下(温馨提示,开启imaegView的触摸事件)
UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
[self.view addGestureRecognizer:pan];
//然后就是把我们触摸到的周边擦去代码如下
CGPoint point = [pan locationInView:self.view];
CGFloat x = point.x - 10;
CGFloat y = point.y - 10;
CGFloat W = 20;
CGFloat H = 20;
CGRect rect = CGRectMake(x, y, W, H);
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, 0.0);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[self.bgTopImageView.layer renderInContext:ctx];
CGContextClearRect(ctx, rect);
UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.bgTopImageView.image = newImage;
效果图