我需要将 UIView 沿着贝塞尔路径从一个点拖到另一个点,最好的方法是什么?
问问题
727 次
1 回答
2
This is the easiest way to do drag a uiview from one point to another point.
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"];
于 2013-06-01T07:47:42.783 回答