Skip to content

Instantly share code, notes, and snippets.

@0xMarK
Created January 28, 2014 22:53
Show Gist options
  • Save 0xMarK/8678345 to your computer and use it in GitHub Desktop.
Save 0xMarK/8678345 to your computer and use it in GitHub Desktop.
Create mask layer with image file
// Create mask layer
UIImage *maskImage = [UIImage imageNamed:@"posterMask"];
CAShapeLayer* maskLayer = [CAShapeLayer layer];
maskLayer.frame = CGRectMake(0, 0, maskImage.size.width,maskImage.size.height);
maskLayer.contents = (__bridge id)maskImage.CGImage;
self.poster.layer.mask = maskLayer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment