2017-03-03 5 views
3

J'ai un UIBezierPath coup, maintenant je veux obtenir le contour du tracé de la course (pas la trajectoire de la course elle-même), y at-il un moyen de l'obtenir? ou au moins NSLog le chemin de contour de UIBezierPath? MerciObtenir le contour de contour de l'UIBezierPath

Répondre

5

Vous pouvez utiliser CGPathCreateCopyByStrokingPath pour cela.

UIBezierPath *path = ...; 
CGFloat lineWidth = 10; 
CGPathRef cgStrokedPath = CGPathCreateCopyByStrokingPath(path.CGPath, NULL, 
    lineWidth, kCGLineCapRound, kCGLineJoinRound, 0); 
UIBezierPath *strokedPath = [UIBezierPath bezierPathWithCGPath:cgStrokedPath]; 
+0

c'est exactement ce que je cherche! Merci!! – jane

+0

N'oubliez pas d'appeler 'CGPathRelease (cgStrokedPath);'! – JimmyB