This is the code i have:
CGFloat buttonGradient1Colors [] = {
[gradient1TopColor ], 1.0, 1.0, 0.16,
0.0, 0.0, 0.0, 0.11
};
But i want to add an if statement, where the float changes it’s value based on something, and so i need to set up the CGFloat beforehand. I tried:
CGFloat buttonGradient1Colors;
and
CGFloat buttonGradient1Colors [];
but the second one gave me an error on the line, and the first one gave me an error further on. Any ideas?
EDIT:
So now i have this:
CGFloat buttonGradient1Colors [8];
buttonGradient1Colors [8] = {
1.0, 1.0, 1.0, 0.16,
0.0, 0.0, 0.0, 0.11
};
but it’s giving me an ‘expected expression’ error on the 2nd line.
You have to specify the size when you creating a C array.
If you want to change the value. You can do like this