美文网首页
iOS文字加一个横线

iOS文字加一个横线

作者: Faith_K | 来源:发表于2016-05-12 09:04 被阅读1140次

UITableViewCell * cell;

NSUInteger length = [cell.textLabel.text length];

NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:cell.textLabel.text];

[attri addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, length)];

[attri addAttribute:NSStrikethroughColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, length)];

[cell.textLabel setAttributedText:attri];

相关文章

网友评论

      本文标题:iOS文字加一个横线

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