Reputation: 25751
I have the following code to create a gradient (or start of one):
CAGradientLayer *gradient = [CAGradientLayer layer];
UIColor *lightGreen = [UIColor colorWithRed:66.0f/255.0f green:79.0f/255.0f blue:91.0f/255.0f alpha:1.0f];
UIColor *darkGreen = [UIColor colorWithRed:66.0f/255.0f green:79.0f/255.0f blue:91.0f/255.0f alpha:1.0f];
Why does this line give me "Expected identifier"?
gradient.colors = [NSArray arrayWithObjects:(id)[lightGreen.CGColor]];
Upvotes: 0
Views: 186
Reputation: 69499
You have to many [
in your code and you are not closing with , nil
:
gradient.colors = [NSArray arrayWithObjects:(id)[lightGreen.CGColor]];
Should be:
gradient.colors = [NSArray arrayWithObjects:(id)lightGreen.CGColor, nil];
Or even:
gradient.colors = @[(id)lightGreen.CGColor];
Upvotes: 1