Skip to content

Instantly share code, notes, and snippets.

@saiday
Created March 19, 2015 14:29
Show Gist options
  • Select an option

  • Save saiday/2242182fc01fc1be62be to your computer and use it in GitHub Desktop.

Select an option

Save saiday/2242182fc01fc1be62be to your computer and use it in GitHub Desktop.
TableView with soften edges
CAGradientLayer *maskLayer = [CAGradientLayer layer];
CGColorRef outerColor = [UIColor colorWithWhite:1.0 alpha:0.0].CGColor;
CGColorRef innerColor = [UIColor colorWithWhite:1.0 alpha:1.0].CGColor;
maskLayer.colors = @[(__bridge id)outerColor, (__bridge id)innerColor];
maskLayer.locations = @[@0, @.05];
maskLayer.bounds = self.tableView.bounds;
maskLayer.anchorPoint = CGPointZero;
maskLayer.position = CGPointMake(0, -self.tableView.contentInset.top);
self.tableView.layer.mask = maskLayer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment