Can someone explain to me why this is always always getting only one color (which is yellow)? The only change I could make is by changing the value of blue. If I put blue as 0, then everything becomes white. I really don’t get it….I thought I would be getting a wide range of colors between red and (yellow and) green.
int randomNum = arc4random()%255;
int greenLevel;
greenLevel = 255-randomNum;
NSLog(@"%i",greenLevel);
if (posi==NO){
greenLevel=randomNum;
}
CGContextSetRGBFillColor(contextRef, 244, greenLevel, 30, 1);
First, what is the greenLevel for?
Why not just use…
Much tidier.
Second, the range for specifying colors is from 0 to 1 so you’ll need to divide your 255 colours by 255 in order to get them for iOS.