【问题标题】:nstextview change color some textnstextview 改变颜色一些文本
【发布时间】:2012-04-27 09:57:21
【问题描述】:

嗨,我有一个 NS TexView:

    [risultato setString:[NSString stringWithFormat:@"%@\n<Ricetta>\n\t<numero>%@</numero>\n\t<fbimage>http://www.aletrnativeindustries.it/piccole_ricette/%@.png</fbimg>\n\t<foto>%@.png</foto>\n\t<nome>%@</nome>\n\t<dose>X%@</dose>\n\t<tempo>%@</tempo>\n\t<ricetta>%@</ricetta>\n</Ricetta>\n", prec, number, photo, photo, title, dos, time, ric]];


    risultato.textColor = [NSColor redColor];

在最后一条指令中,我将所有颜色更改为红色,但如果我希望某些文本保持黑色? 我需要那个 prec,数字,照片,照片,标题,dos,时间,摆脱保持黑色。 prec, number.... 是 NSString。

【问题讨论】:

    标签: xcode nstextview


    【解决方案1】:

    您需要创建一个NSAttributedString

    【讨论】:

    • 感谢您的回复,但对我帮助不大,而且有点笼统。
    猜你喜欢
    • 2011-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-04
    • 2013-07-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多