Sai*_*son 2 objective-c nsattributedstring ios
我的代码已经有了这个属性,但是如何为下划线添加属性?
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
boldFont, NSFontAttributeName, foregroundColor, NSForegroundColorAttributeName, nil];
Run Code Online (Sandbox Code Playgroud)
Mar*_*bri 13
只需添加一个NSUnderlineStyleAttributeName键@(NSUnderlineStyleSingle)作为值:
NSDictionary *attrs = @{ NSFontAttributeName : boldFont,
NSForegroundColorAttributeName : foregroundColor,
NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle) };
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5504 次 |
| 最近记录: |