Meh*_*tri 6 iphone objective-c masking ipad uibezierpath
我怎样才能UIBezierpath从UIImage这样的..

我不想要完整的方形路径,只想从UIImage的红色边框中显示该路径.
我已经完成了以下代码来获取屏蔽路径..
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = imgView.frame;
UIBezierPath *roundedPath = [UIBezierPath bezierPathWithRoundedRect:maskLayer.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(50.f, 50.f)];
Run Code Online (Sandbox Code Playgroud)
基本上我想要UIBezierpath遵循像A,B等字母的形状.等.
请告诉我这是否可能获得这种类型的路径?
提前致谢..
jam*_*mil -5
试试这个代码:
CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation
animationWithKeyPath:@"position"];
pathAnimation.calculationMode = kCAAnimationPaced;
pathAnimation.fillMode = kCAFillModeForwards;
pathAnimation.removedOnCompletion = NO;
pathAnimation.duration = 15.0;
pathAnimation.repeatCount = 1;
CGMutablePathRef curvedPath = CGPathCreateMutable();
CGPathMoveToPoint(curvedPath, NULL, x+15, y);
CGPathAddQuadCurveToPoint(curvedPath, NULL, 20, 10, 100, 330);
pathAnimation.path = curvedPath;
CGPathRelease(curvedPath);
Yourimage.center=CGPointMake(x, y);
[Yourimage.layer addAnimation:pathAnimation forKey:@"moveTheSquare"];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2145 次 |
| 最近记录: |