【发布时间】:2012-04-25 06:09:46
【问题描述】:
当使用下面的 sn-p 时,我得到了 undefined / undeclared error
NSForegroundColorAttributeName
我的代码sn-p
NSMutableAttributedString * string = [[NSMutableAttributedString alloc] initWithString:self.myDisplayTxt];
[string addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0,5)];
请告诉我
【问题讨论】:
-
NSForegroundColorAttributeName是 Mac OSX 核心库的一部分。所以你能不能发布一些代码让大家知道你是如何实现的。 -
@hpiOSCoder:请帮帮我,我已经包含了我的代码。谢谢
-
嘿,是的,我在上面。实际上,NSAttributedString 类参考文档说(在方框内的注释中)对于 iOS,你使用 CoreText 框架。所以我尝试添加框架,但没有解决错误。并且运气不好,您提供的链接没有说明任何内容。