2012-05-22 13 views
6

मास्किंग से UIBezierpath जाओ कैसे मैं इस तरह UIImage से UIBezierpath प्राप्त कर सकते हैं ..एक UIImage

enter image description here

मैं पूर्ण वर्ग पथ नहीं करना चाहते, बस उस पथ चाहते हैं UIImage से लाल बॉर्डर में दिखाया गया है ..

मैं Link 1 और Link 2 के माध्यम से चला गया था, लेकिन सफलता नहीं मिल सकते हैं ..

मैं मास्किंग पथ प्राप्त करने के लिए कोड का पालन किया था ..

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

मूल रूप से मैं UIBezierpath कि ए, बी जैसे अक्षर के आकार इस प्रकार है .. आदि प्राप्त करना चाहते हैं

कृपया मुझे बताओ कि यह संभव है या पथ के इस प्रकार प्राप्त करने के लिए नहीं ??

अग्रिम धन्यवाद ..

+0

क्या आपने इस मुद्दे को हल किया? ऐसा लगता है कि स्टैक ओवरफ्लो पर आपके प्रश्न का अभी भी कोई जवाब नहीं है ...: o ( – 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-object-along-a-path/ – jamil

+0

यह उत्तर बिल्कुल पूछे गए प्रश्न से संबंधित नहीं है। उन्होंने पूछा कि UIBezierPath कैसे प्राप्त करें जो उस आकार को आकर्षित कर सकता है, पथ के बारे में एनीमेशन नहीं । –

0

अन्य उपयोगकर्ताओं के जवाब की तलाश में के लिए, एक वैकल्पिक दृष्टिकोण पाया जा सकता है here (एक स्रोत छवि फ़ाइल के रूप एसवीजी का उपयोग करना और PocketSVG कन्वर्ट करने के लिए पथों के लिए)