Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Duke Leto

macrumors regular
Original poster
Mar 17, 2008
166
0
I have a UIColor, and I want to use it for the CGContextSetFillColor() method. I tried
PHP:
CGColorRef fillColor = [theColor CGColor];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColor(context, fillColor);

The problem is a warning saying
"passing argument 2 of 'CGContextSetFillColor' from incompatible pointer type"

How can I use the UIColor to set my fill color?
 

Duke Leto

macrumors regular
Original poster
Mar 17, 2008
166
0
Now I don't have any warnings, but when I try to set a CGColorRef to [theColor CGColor], the application crashes.
:confused:

Another thing I found: this only happens when I make the color with [UIColor colorWithRed:Blue:Green:Alpha];, but if I use [UIColor cyanColor] or something, it works.
 

Duke Leto

macrumors regular
Original poster
Mar 17, 2008
166
0
Is there any way to create a custom color that can become a CGColorRef?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.