在CABasicAnimation之后CGPathRelease崩溃应用程序?

时间:2015-10-28 03:43:55

标签: ios objective-c core-animation cabasicanimation quartz-core

我有一个平移手势识别器来执行一些工作。当手势状态为UIGestureRecognizerStateEnded时,执行CABasicAnimation。代码:

CGPathRef path = [self pathToAnimateWithX:0 andY:0];
CABasicAnimation *animation = [CABasicAnimation  animationWithKeyPath:@"path"];
animation.fromValue = (__bridge id _Nullable)(dragLayer.path);
animation.toValue = (__bridge id)path;
animation.duration = 0.5;
[dragLayer addAnimation:animation forKey:@"dd"];

此代码工作正常。没有问题。但是当我像这样发布path时:

CGPathRelease(path);

我的应用程序将崩溃,没有崩溃信息。

更新:此处为pathToAnimateWith:方法

- (CGPathRef)pathToAnimateWithX:(CGFloat)x andY:(CGFloat)y {

     UIBezierPath *path = [UIBezierPath bezierPath];
     // configure path
     [path closePath];
     return path.CGPath;
 }

0 个答案:

没有答案