I want to draw triangle with rectangle like this image.
But I can draw like this shape using this code.
CAShapeLayer *mask = [[CAShapeLayer alloc] init];
mask.frame = imgTest.layer.bounds;
CGFloat width = imgTest.layer.frame.size.width;
CGFloat height = imgTest.layer.frame.size.height;
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, nil, 30, 0);
CGPathAddLineToPoint(path, nil, width, 0);
CGPathAddLineToPoint(path, nil, width, height);
CGPathAddLineToPoint(path, nil, 0, height);
CGPathAddLineToPoint(path, nil, 30, 0);
CGPathCloseSubpath(path); mask.path = path;
CGPathRelease(path);
imgTest.layer.mask = mask;
So how can I draw like first image shape?