Re: NSColor may not respond to colorWithCalibratedRed
Re: NSColor may not respond to colorWithCalibratedRed
- Subject: Re: NSColor may not respond to colorWithCalibratedRed
- From: Steve Christensen <email@hidden>
- Date: Sat, 27 Dec 2008 07:20:26 -0800
That's because you're trying to call a class method as an instance
method. It's defined as:
+ (NSColor *)colorWithCalibratedRed:(float)red green:(float)green
blue:(float)blue alpha:(float)alpha;
which means you'd use it (in your example) like this:
[[NSColor colorWithCalibratedRed:5.0 green:150.0 blue:15.0 alpha:0.5]
set];
One other thing to point out is that the RGBA component values have a
range of 0 to 1. Any values below 0 are pinned at 0; any values above
1 are pinned at 1.
steve
On Dec 27, 2008, at 6:54 AM, Joseph Ayers wrote:
I'm trying to create a dark green color.
In
NSColor * darkGreenColor;
darkGreenColor = [[NSColor alloc] init];
[[darkGreenColor colorWithCalibratedRed:5.0 green:150.0 blue:15.0
alpha:0.5] set];
I get a compile warning
'NSColor' may not respond to 'colorWithCalibratedColorRed....'
What's wrong here?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden