【问题标题】:NSString value Crossout iphoneNSString 值 Crossout iphone
【发布时间】:2013-01-28 12:07:55
【问题描述】:

如何在中间划掉字符串 $127.95。 罢工有什么简单的方法吗?

【问题讨论】:

标签: iphone objective-c ios5


【解决方案1】:

从iOS6开始你可以使用NSAttributedString

NSDictionary *attributes = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlinePatternSolid | NSUnderlineStyleSingle]};

NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:@"$127.95" attributes:attributes];

【讨论】:

    【解决方案2】:

    使用https://github.com/mattt/TTTAttributedLabel 替换UILabel,它可以很好地完成所有核心文本的繁重工作。

    【讨论】:

      【解决方案3】:

      请看这个答案:

      CoreText and strikethrough on iPhone

      它建议使用此处描述的核心文本:

      http://www.cocoanetics.com/2011/01/befriending-core-text/

      注意:这仅适用于 iOS6。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-07-26
        • 2011-02-06
        • 2012-05-24
        • 2010-11-15
        • 1970-01-01
        • 2011-01-30
        • 2010-11-26
        相关资源
        最近更新 更多