jjzjj

CGPathCreateMutable

全部标签

calayer - 无法释放 CGPathCreateMutable 在 Swift 中创建的路径

我在Swift中有这个简单的代码:overridevarbounds:CGRect{didSet{if(bounds!=oldValue){varpath=CGPathCreateMutable()CGPathAddEllipseInRect(path,nil,bounds)self.path=pathCGPathRelease(path)}}}它应该在图层的bounds更改时绘制一个填充图层的圆。这是从我的旧Objective-C代码移植过来的,它运行良好:-(void)setBounds:(CGRect)bounds{if(CGRectEqualToRect(self.bounds