2017-09-08 21 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로 설정하려고하면 이미지 뷰의 레이어 cornerRadius을 모서리 부드럽게하기위한 원하는 크기로 만듭니다.

+0

답장을 보내 주셔서 감사합니다. 내 ImageView의 clipToBound 속성이 이미 TRUE로 설정되어 있습니다. 속성 관리자에서. 나에게 같은 데모 프로젝트를 제공 할 수 있다면 매우 기쁩니다. –