4

NSAttributedStringがiPhoneに追加されたと聞きましたが、色を設定するためにキーNSForegroundColorAttributeNameを使用すると、「NSForegroundColorAttributeNameundeclared」というエラーが表示されます。私は何かが足りないのですか?私を助けてください。

よろしく

ヤラッパ

4

2 に答える 2

11

BarretJ が kCTForegroundColorAttributeName 定数を使用すると述べたのと同じ問題に遭遇しました。次に例を示します。

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

[attrStr addAttribute:(NSString*)kCTForegroundColorAttributeName 
                value:(id)[[UIColor greenColor] CGColor]
                range:range];
于 2010-10-06T15:57:16.123 に答える
9

代わりにkCTForegroundColorAttributeNameを使用してみてください。

于 2010-09-23T18:20:29.363 に答える