Skip to content

Instantly share code, notes, and snippets.

@rodericj
Created November 20, 2014 01:02
Show Gist options
  • Save rodericj/7eec9de86255ec16b1cf to your computer and use it in GitHub Desktop.
Save rodericj/7eec9de86255ec16b1cf to your computer and use it in GitHub Desktop.
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
CGRect maskRect = self.coneImageView.frame;
NSLog(@"Mask rect is %@", NSStringFromCGRect(maskRect));
// Create a path with the rectangle in it.
CGPathRef path = CGPathCreateWithRect(maskRect, NULL);
// Set the path to the mask layer.
maskLayer.path = path;
// Release the path since it's not covered by ARC.
CGPathRelease(path);
// Set the mask of the view.
self.connectorLine.layer.mask = maskLayer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment