Skip to content

Instantly share code, notes, and snippets.

@AlexHedley
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save AlexHedley/ce30093516d5cf99ea35 to your computer and use it in GitHub Desktop.

Select an option

Save AlexHedley/ce30093516d5cf99ea35 to your computer and use it in GitHub Desktop.
Button Gradient
CAGradientLayer* gradientLayer = [[CAGradientLayer alloc] init];
[gradientLayer setBounds:[buttonTest bounds]];
[gradientLayer setPosition:
CGPointMake([buttonTest bounds].size.width/2, [buttonTest bounds].size.height/2)];
[gradientLayer setColors:
[NSArray arrayWithObjects:
(id)[[UIColor blueColor] CGColor],
(id)[[UIColor cyanColor] CGColor], nil]];
[[buttonTest layer] insertSublayer:gradientLayer atIndex:0];
//http://www.wmdeveloper.com/2012/01/uibutton-with-gradient.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment