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

anuroop

macrumors newbie
Original poster
Mar 26, 2009
4
0
hi all,
i m using a function in my project as written below to make shadow effect on the text drawn:

CGContextSetShadowWithColor(context, CGSizeMake(2, -2), 1, CGColorGetConstantColor(kCGColorBlack));


but it gives warning in 2.2.1 sdk that "kCGColorBlack" is unavailable and if i compile my project in 3.0 it gives error showing same thing.

if there is anybody to tell me the alternate of kCGColorBlack then i'll be very thankfull to him.
 
I'm not sure why this is.

In the header it's defined as:
Code:
CG_EXTERN CGColorRef CGColorGetConstantColor(CFStringRef colorName)
    CG_AVAILABLE_STARTING(__MAC_10_5, [B]__IPHONE_2_0[/B]);
But kCGColorBlack is defined as:
Code:
CG_EXTERN const CFStringRef kCGColorBlack
    CG_AVAILABLE_STARTING(__MAC_10_5, [b]__IPHONE_NA[/b]);
Why would they define the function but not let you use the constants? :confused:
 
kCGColorBlack is just a CFStringRef constant.

You can still use CGColorGetConstantColor, like so:

NSString* blackString = [NSString stringWithString:mad:"kCGColorBlack"];
CGColorGetConstantColor((CFStringRef)blackString);
 
Try

Code:
[UIColor blackColor].CGColor

I don't know why that string constant is __IPHONE_NA but it is so it's not available.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.