2017-09-08 77 views
1

我知道如何在平移时清除imageView,但是当我这样做时清除了锐利边缘的图像,但是我想要的是在使用Swift3在iOS上对ImageView进行平移时,使用柔和/平滑边缘清除ImageView?希望我清楚我的问题。如何清除ImageView?

//For clearing the imageView I use this method. 

func draw(fromPoint:CGPoint,toPoint:CGPoint) { 

     if draw { 

      UIGraphicsBeginImageContext(self.viewBelowScrollView.bounds.size)// ?? 
      let context = UIGraphicsGetCurrentContext() 
      frontImageView.image?.draw(in: self.viewBelowScrollView.bounds) 
      context?.setLineCap(CGLineCap.round) 
      context?.setLineWidth(CGFloat(sizeSliderOutlet.value)) 

      context?.move(to: CGPoint(x: fromPoint.x, y: fromPoint.y)) 
      context?.addLine(to: CGPoint(x: toPoint.x, y: toPoint.y)) 
      context?.setBlendMode(CGBlendMode.clear) 
      //Setting the Line Configuration 
      context?.strokePath() 
      //Setting all the things done on the Image View Now. 
      frontImageView.image = UIGraphicsGetImageFromCurrentImageContext() 
      UIGraphicsEndImageContext() 

     } 
    } 

//任何帮助将不胜感激。先谢谢你。

回答

0

尝试将imageview的clipsToBounds设置为true,同时使imageview的图层cornerRadius达到所需的角度平滑度。

+0

谢谢你的回复,我的ImageView的clipToBound属性已设置为TRUE。来自财产督察。如果您能为我提供相同的演示项目,我将非常高兴。 –