2012-05-22 14 views
6

をマスキング..取得UIBezierpath私はこのような<code>UIImage</code>から<code>UIBezierpath</code>を取得できますかUIImage

enter image description here

から私は、完全な正方形のパスをしたくないUIImageから赤枠で示したように、ちょうどそのパスをしたいです。..

私はLink 1Link 2を通じて行っていたが、成功を持っていないことができます。..

私はマスキングパスを取得するコードを以下の行っていた。..

CAShapeLayer *maskLayer = [CAShapeLayer layer]; 
maskLayer.frame = imgView.frame; 
UIBezierPath *roundedPath = [UIBezierPath bezierPathWithRoundedRect:maskLayer.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(50.f, 50.f)]; 

基本的に私は、など.. A、Bのようなアルファベットの形状を以下のUIBezierpathを取得したい

を教えてくださいパスのこのタイプを取得するには、この可能かありません?事前に

おかげ..

+0

問題を解決しましたか?それはまだstackoverflowであなたの質問に答えがないようです::( – Dirk

答えて

-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"]; 
+0

また、このチュートリアルを確認..それはあなたの問題を解決すると思う.. http://blog.devedup.com/index.php/2010/03/03/iphone-animate-an-a-path-along-a-path/ – jamil

+0

この質問には全く関係のない質問が関係していますが、パスについてのアニメーションではなく、その形を描くUIBezierPath 。 –

0

は、別のアプローチは、here(変換するために、元の画像ファイルとしてSVGを使用してPocketSVG見つけることができます

関連する問題