gpt4 book ai didi

ios - 使用属性文本修改下划线的宽度?

转载 作者:行者123 更新时间:2023-11-28 18:56:48 27 4
gpt4 key购买 nike

有没有办法修改 NSAttributedString 下划线的线宽?

看起来我可以很容易地修改颜色,但我不能轻易修改下划线本身的宽度。

最佳答案

可以设置NSUnderlineStyleThick或者NSUnderlineStyleSingle,eg:

NSAttributedString *str = [[NSAttributedString alloc] initWithString:@"Thick underline" attributes:@{NSUnderlineStyleAttributeName: @(NSUnderlineStyleThick)}];
NSAttributedString *str = [[NSAttributedString alloc] initWithString:@"Normal underline" attributes:@{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle)}];

完整的下划线样式列表:https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/NSAttributedString_UIKit_Additions/index.html#//apple_ref/c/tdef/NSUnderlineStyle

关于ios - 使用属性文本修改下划线的宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31665190/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com