Skip to content

Instantly share code, notes, and snippets.

@yfujiki
Last active December 16, 2015 00:19
Show Gist options
  • Save yfujiki/5347245 to your computer and use it in GitHub Desktop.
Save yfujiki/5347245 to your computer and use it in GitHub Desktop.
Apply image mask to a view
CALayer *mask = [CALayer layer];
mask.contents = (id)[maskingImage CGImage];
mask.frame = (CGRect){0, 0, maskingImage.size};
view.layer.mask = mask;
view.layer.masksToBounds = YES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment