Skip to content

Instantly share code, notes, and snippets.

@victorchee
Created April 21, 2014 08:27
Show Gist options
  • Save victorchee/11136166 to your computer and use it in GitHub Desktop.
Save victorchee/11136166 to your computer and use it in GitHub Desktop.
iOS线性渐变视图
AGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.frame = self.view.frame;
gradientLayer.colors = [NSArray arrayWithObjects:(id)baseColor.CGColor, (id)barColor.CGColor, nil];
[self.view.layer insertSublayer:gradientLayer atIndex:0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment