尝试设置属性时我收到了NSObject doesNotRecognizeSelector错误,我不知道为什么。Obj-C选择器在属性上未被识别?
错误发生在setWithNSColor的第一行。我很困惑如何合理地合成一个属性可能无法识别。
@interface ScopeColor : NSObject {
NSString *colorIntegerString;
float redColor;
float greenColor;
float blueColor;
NSString *name;
}
@property (readwrite, assign) NSString *colorIntegerString;
@property (readwrite, assign) float redColor;
@property (readwrite, assign) float greenColor;
@property (readwrite, assign) float blueColor;
@property (readwrite, assign) NSString *name;
-(void)setWithNSColor:(NSColor *)inColor
{
self.redColor=[inColor redComponent];
self.greenColor=[inColor greenComponent];
self.blueColor=[inColor blueComponent];
}
Doh。我相信你是对的。 – wadesworld 2009-12-26 19:52:26