2017-09-08 10 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に設定されています。プロパティインスペクタから取得します。あなたが同じデモプロジェクトを私に提供できるなら、私はとてもうれしく思います。 –

関連する問題