Ios 沿贝塞尔路径拖动UIView

Ios 沿贝塞尔路径拖动UIView,ios,animation,uiview,Ios,Animation,Uiview,我需要沿bezier路径将UIView从一点拖动到另一点,最好的方法是什么?这是将UIView从一点拖动到另一点的最简单方法 UIBezierPath *path = [UIBezierPath bezierPath]; [path moveToPoint:startingPoint]; [path addLineToPoint:endPoint]; //you can use addCurveToPoint: , addArcToPoint:, etc CAKeyframeAnimatio

我需要沿bezier路径将UIView从一点拖动到另一点,最好的方法是什么?

这是将UIView从一点拖动到另一点的最简单方法

UIBezierPath *path  = [UIBezierPath bezierPath];
[path moveToPoint:startingPoint];
[path addLineToPoint:endPoint]; //you can use addCurveToPoint: , addArcToPoint:, etc

CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
pathAnimation.duration = 10.0;
pathAnimation.path = path;
pathAnimation.removeOnCompletion = NO ;
[myView.layer addAnimation:pathAnimation forKey:@"pathAnimation"];

这不是移动
UIView
,而是移动
CALayer