gpt4 book ai didi

ios - 如何清除ImageView?

转载 作者:行者123 更新时间:2023-11-28 08:02:55 26 4
gpt4 key购买 nike

我知道如何在平移时清除 imageView,但是当我这样做时,它会清除边缘锐利的图像,但我想要的是在使用 Swift3 在​​ iOS 中的 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()

}
}

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

最佳答案

尝试制作 imageview 的 clipsToBounds为真,也使 imageview 的层的 cornerRadius到角平滑度所需的大小。

关于ios - 如何清除ImageView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46112723/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com