1
我不確定何時在下面的代碼示例中釋放由CGPathCreateMutable創建的路徑。何時發佈CGMutablePathRef
// iVar
ivarImageView = [[UIImageView alloc] initWithImage:nil];
// Clip to shape
CALayer *imageLayer = [self.ivarImageView layer];
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
CGMutablePathRef clipPath = CGPathCreateMutable();
shapeLayer.path = clipPath;
imageLayer.mask = shapeLayer;
[self addSubview:self.ivarImageView];
iVarImageView是保留的伊娃。所以它被用於對象的生命,就像它的shapLayer.path一樣。那麼什麼時候才能發佈這條路?