Skip to content

Instantly share code, notes, and snippets.

@arnaudbos
Created January 17, 2012 13:05
Show Gist options
  • Save arnaudbos/1626567 to your computer and use it in GitHub Desktop.
Save arnaudbos/1626567 to your computer and use it in GitHub Desktop.
Set gradient color in Objective-C
theView.backgroundColor = [UIColor clearColor];
CAGradientLayer *layer = (CAGradientLayer *)theView.layer;
CGColorRef liteColor = [UIColor colorWithWhite:0.92f alpha:0.8f].CGColor;
CGColorRef darkColor = [UIColor colorWithWhite:0.32f alpha:0.8f].CGColor;
layer.colors = [NSArray arrayWithObjects:(id)liteColor, (id)darkColor, nil];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment