gpt4 book ai didi

iphone - Objective-C 中的删除线字体

转载 作者:太空狗 更新时间:2023-10-30 03:13:52 29 4
gpt4 key购买 nike

如何在 Objective-C 中使用删除线字体???更具体地说在 UITableViewCell 中

cell.textLabel.text = name;
cell.detailTextLabel.text = quantity ;
cell.XXX = ??

最佳答案

我是 Marin,“iOS6 by Tutorials”中属性字符串章节的作者。

自 iOS6 以来,实际上原生支持一堆不同的文本属性,包括删除线。

这是一个简短的示例,您可以将其用于单元格文本标签:

NSDictionary* attributes = @{
NSStrikethroughStyleAttributeName: [NSNumber numberWithInt:NSUnderlineStyleSingle]
};

NSAttributedString* attrText = [[NSAttributedString alloc] initWithString:@"My Text" attributes:attributes];
cell.textLabel.attributedText = attrText;

就是这样。祝你好运!

关于iphone - Objective-C 中的删除线字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2489530/

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