1

全部,

根据这个NSFont 有唯一的方法来检索下划线字体参数。

有没有办法将字体设置为下划线?

谢谢你。

4

1 回答 1

2

有没有办法将字体设置为下划线?

不,那只是因为你找错了树。

“字体”不能下划线,(至少,我不认为),但字符串可以。

看看 NSAttributedString ...您创建了一个“属性”字典,将其附加到要绘制的 NSString ...“倾斜度”,(表示斜体或不表示斜体),“居中”...所有这些东西。所以它是这样的:

[textAttrDict setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
[textStr drawInRect:textRect withAttributes:textAttrDict];

在标题中搜索 NSUnderlineStyleSingle 以找到您想要的确切枚举...

于 2014-09-09T07:09:04.890 回答