Octave1
Octave1

Reputation: 525

Creating custom RGB colours & implementing custom drawing

I'm trying to do custom drawing & I've created a custom colour:

fawYellowColour = [UIColor colorWithRed: (255.0/255.0 ) green: (221.0/255.0) blue: (0.0/255.0) alpha:1.0];

I now want to use my custom colour to draw, I expected I could simply replace the preset colour with my custom fawYellowColour like this:

CGContextSetFillColorWithColor(ctx, [UIColor fawYellowColour].CGColor);

However I get the message -

error: request for member 'CGColor' in something not a structure or union

Any ideas? thanks in advance :)

Upvotes: 0

Views: 610

Answers (1)

Lily Ballard
Lily Ballard

Reputation: 185771

You've created a variable called fawYellowColour. Then you try and send the message -fawYellowColour to UIColor, expecting a valid result. You should be getting a warning saying that this method doesn't exist. What you really want to say is

CGContextSetFillColorWithColor(ctx, fawYellowColour.CGColor);

Upvotes: 1

Related Questions