我在drawRect()
中绘制了一个形状。
var rectanglePath = UIBezierPath()
override func drawRect(rect: CGRect) {
rectanglePath = UIBezierPath(rect: self.bounds)
rectanglePath.fillWithBlendMode(kCGBlendModeMultiply, alpha: 0.7)
layer.shouldRasterize = true
}
当调用prepareForEditing
函数时,我想要对矩形路径进行动画。我尝试过。
func prepareForEditing(editing:Bool){
UIView.animateWithDuration(0.5,
animations: {
self.rectanglePath = makeNewShape()
}
)
}
什么都没有发生。您能告诉我我的代码有什么问题吗?
fillWithBlend
模式能在 ShapeLayer 上使用吗?我尝试了这种方式,但混合并没有起作用。 - Dănuț Mihai FloriandidMoveToSuperview()
中绘制形状而不是drawRect()
? - Dănuț Mihai Florian