I am having trouble adding color to a string. Here is my code:
-(NSMutableAttributedString *)sarticleTitle {
NSMutableAttributedString *returnTitle;
if ([self newReference]==YES) {
returnTitle=[[NSMutableAttributedString alloc] initWithString:[self articleTitle]];
[returnTitle addAttribute:NSForegroundColorAttributeName value:[NSColor redColor] range:NSMakeRange(0,3)];
}
else {
// returnTitle=[self articleTitle];
}
return returnTitle;
}
articleTitle is different from sarticleTitle and is just an NSString (it was the simple accessor method before I decided to add color). Here are the errors I am getting:
reference.m:70: `NSForegroundColorAttributeName' undeclared (first use in this function)
reference.m:70: `NSColor' undeclared (first use in this function)
Oh yeah, If I leave out the range: argument will it apply the attribute to the whole string?
thanks,
kman