我听说iPhone中添加了nsattribatedstring,但是当我使用键NsforegroundColorattributeName来设置颜色时,我会遇到一个错误,说“ nsforegroundColortoRattributeName undeclared”。我缺少什么吗?请帮我。

问候

yallappa

有帮助吗?

解决方案

尝试使用KCT ForegroundColoratTributeName。

其他提示

我遇到了与Barretj提到的同一问题,您使用KCT ForegroungroundColoratTributename常数。这是一个示例:

NSMutableAttributedString* attrStr = [[NSMutableAttributedString alloc] initWithString:countStr attributes:nil];

[attrStr addAttribute:(NSString*)kCTForegroundColorAttributeName 
                value:(id)[[UIColor greenColor] CGColor]
                range:range];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top