CoreAnimation を使用して UIImageView (曲線ベジエ アニメーション) をアニメーション化します。これが私のコードです:
CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
pathAnimation.calculationMode = kCAAnimationCubic;
pathAnimation.fillMode = kCAFillModeForwards;
pathAnimation.removedOnCompletion = NO;
CGPoint endPoint = originalPosition;
UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:star.layer.position];
[path addQuadCurveToPoint:endPoint controlPoint:CGPointMake(star.layer.position.x, endPoint.y)];
pathAnimation.path = path.CGPath;
[star.layer addAnimation:pathAnimation forKey:@"moveToScorebarAnimation"];
その結果、スタックトレースでEXC_BAD_ACCESS (code=2, address=0x0)を取得します。
CoreGraphics`CG::Path::apply(void*, void (*)(void*, CGPathElementType, CGPoint const*)) const:
0x613c06: pushl %ebp
0x613c07: movl %esp, %ebp
0x613c09: subl $24, %esp
0x613c0c: movl 8(%ebp), %eax
0x613c0f: movl (%eax), %ecx
0x613c11: movl (%ecx), %eax
0x613c13: movl 16(%ebp), %edx
0x613c16: movl %edx, 8(%esp)
0x613c1a: movl 12(%ebp), %edx
0x613c1d: movl %edx, 4(%esp)
0x613c21: movl %ecx, (%esp)
0x613c24: calll *64(%eax)
0x613c27: addl $24, %esp
0x613c2a: popl %ebp
0x613c2b: ret
別のマニュアルを使用してそれを実行しようとしましたが、アプリは同じようにクラッシュします。私のせいがどこにあるのか理解できません。どんな助けでも感謝します、ありがとう。
PS 似たようなバグがありますが、残念ながらアニメーションを削除するだけで解決します。
PPS アークが有効になっています。また、pathAnimation.path = path.CGPath;にコメントすると、行、クラッシュは表示されず、アニメーションも表示されません(驚くことではありません:))。