美文网首页UIKit
iOS 10.3系统富文本设置中划线失效

iOS 10.3系统富文本设置中划线失效

作者: rockyMJ | 来源:发表于2017-04-21 17:42 被阅读442次

富文本中有中文字符会设置失效(10.3)
原因:可能是苹果10.3系统的bug.
解决方法:让富文本支持中文
NSBaselineOffsetAttributeName : @(NSUnderlineStyleSingle)

NSString *str = [NSString stringWithFormat:@"中文字符¥%@",@"9999"];
        NSMutableAttributedString *attributeMarket = [[NSMutableAttributedString alloc] initWithString:str];
        [attributeMarket setAttributes:@{NSStrikethroughStyleAttributeName: @(NSUnderlineStyleSingle), NSBaselineOffsetAttributeName : @(NSUnderlineStyleSingle)} range:NSMakeRange(0,str.length)];

        _label.attributedText = attributeMarket;

一下链接是网上大神总结的比较详细的富文本使用方法

传送门1
传送门2
强大的第三方富文本框架

相关文章

网友评论

  • yuebiubiu:不错,刚好用到,学习了,多谢老铁
    rockyMJ:能帮到老铁就行

本文标题:iOS 10.3系统富文本设置中划线失效

本文链接:https://www.haomeiwen.com/subject/ihzdzttx.html