iOS文字加一个横线

2016-05-12  本文已影响1140人  Faith_K

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];

上一篇 下一篇

猜你喜欢

热点阅读