Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Constant kCGColors deprecated on iPhone?

I'm having some trouble getting CGColorGetConstantColor() to work on the iPhone. Apple's documentation claims you can pass any of the "Constant Colors" without linking to what the Constant Colors actually are, so I assumed you can simply use those documented for OS X:

CGColorRef blackColor = CGColorGetConstantColor(kCGColorBlack);

This does not seem to be the case however, as Xcode throws me this error: "'kCGColorBlack' is unavailable (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColor.h:123)"

Anyone know what the new constants are (and where they're documented)?

like image 230
Michael Avatar asked Dec 23 '22 09:12

Michael


1 Answers

Have a look at UIColor:

CGColorRef blackColor = [[UIColor blackColor] CGColor];
like image 187
Matt Long Avatar answered Jan 07 '23 00:01

Matt Long