Skip to content

Instantly share code, notes, and snippets.

@adow
Created December 5, 2013 06:48
Show Gist options
  • Save adow/7801157 to your computer and use it in GitHub Desktop.
Save adow/7801157 to your computer and use it in GitHub Desktop.
mask layer
_maskLayer=[[CAGradientLayer layer]retain];
_maskLayer.frame=self.bounds;
_maskLayer.colors=@[(id)[UIColor colorWithRed:255/255.0f green:255.0f/255.0f blue:255/255.0f alpha:1.0f].CGColor,
(id)[UIColor colorWithRed:255/255.0f green:255.0f/255.0f blue:255/255.0f alpha:0.0f].CGColor];
_maskLayer.startPoint=CGPointMake(0.5, 0.3f);
_maskLayer.endPoint=CGPointMake(0.5f, 1.0f);
_maskLayer.locations=@[@0.0f,@1.0f];
self.layer.mask=_maskLayer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment