我试图在文本的一部分上加上“粗体”,但我做不到。
我正在使用这个:
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"this is a part of the text"];
NSRange selectedRange = NSMakeRange(5, 10);
[string beginEditing];
[string addAttribute:NSFontAttributeName
value:[NSFont fontWithName:@"Helvetica-Bold" size:12.0]
range:selectedRange];
[string endEditing];
我收到错误“使用未声明的标识符 NSFontAttributeName”;
我该怎么做?