gpt4 book ai didi

ios - 如何在 UILabel 上为下划线创建属性?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:52:05 24 4
gpt4 key购买 nike

我的代码中已经有了这个属性,但是如何添加下划线属性呢?

NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys: 
boldFont, NSFontAttributeName, foregroundColor, NSForegroundColorAttributeName, nil];

最佳答案

只需添加一个 NSUnderlineStyleAttributeName 键并将 @(NSUnderlineStyleSingle) 作为值:

NSDictionary *attrs = @{ NSFontAttributeName : boldFont, 
NSForegroundColorAttributeName : foregroundColor,
NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle) };

关于ios - 如何在 UILabel 上为下划线创建属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18819665/

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