Creating gradients with Core Graphics in iOS -


i have following code create 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 line give me "expected identifier"?

gradient.colors = [nsarray arraywithobjects:(id)[lightgreen.cgcolor]]; 

you have many [ in code , not closing , 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]; 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -