clip de masquage uiview avec CAShapeLayer et UIBezierPath

J'ai un problème de détourage d'une vue à l'aide de CAShapeLayer-UIBezierPath , je veux clip le contenu, mais que je finis par avoir un accident vasculaire cérébral (frame) avec qui UIBezierPath , C'est mon code

UIBezierPath *path2Path = [UIBezierPath bezierPath];
[path2Path moveToPoint:CGPointMake(206.745, 0)];
[path2Path addLineToPoint:CGPointMake(206.745, 97.613)];
[path2Path addLineToPoint:CGPointMake(0, 97.613)];
[path2Path addLineToPoint:CGPointMake(0, 0)];
[path2Path addLineToPoint:CGPointMake(87.28, 0)];
[path2Path addCurveToPoint:CGPointMake(103.808, 12.118) controlPoint1:CGPointMake(87.28, 0) controlPoint2:CGPointMake(86.555, 12.118)];
[path2Path addCurveToPoint:CGPointMake(119.466, 0) controlPoint1:CGPointMake(121.061, 12.118) controlPoint2:CGPointMake(119.466, 0)];
[path2Path addLineToPoint:CGPointMake(206.745, 0)];
[path2Path closePath];

[path2Path addClip];

CAShapeLayer *pathLayer = [CAShapeLayer layer];
pathLayer.frame=MYVIEW.bounds;
pathLayer.path = path2Path.CGPath;

pathLayer.strokeColor = [[UIColor blackColor] CGColor];
pathLayer.fillColor = [[UIColor clearColor] CGColor];

pathLayer.fillRule=kCAFillRuleEvenOdd;
[MYVIEW.layer setMask:pathLayer];
[MYVIEW.layer setMasksToBounds:YES];

MYVIEW.backgroundColor=[UIColor greenColor];

Le résultat de ce code est juste un vert course ligne ,les limites est vide ,
comme ceci
http://i.stack.imgur.com/aehdo.png

Cependant , je tiens à apporter les limites vert , coupé par ce contour

Vous voulez afficher la seule partie de l'image à l'intérieur de tracé de bézier. Droit?
oui exactement . @RajeshMaurya
Puis-je savoir? lorsque vous écrivez le code? Dans le Viewcontroller ou créé sous-classe UIView.
Avez-vous ajouté une image dans MAVUE?
double possible de l'Utilisation Tracé de Bézier comme Masque d'Écrêtage

OriginalL'auteur Aproram | 2015-06-19