您的位置:首页 > 其它

NSMutableAttributedString 富文本框 设置下划线

2015-09-20 12:36 357 查看
NSString *priceString = [NSString
stringWithFormat:@"原价:%@万", myModel.price];
    NSMutableAttributedString *attributedString1 = [self
setLabelAttriButeString:priceString
andModelLength:myModel.price2.length];
    [attributedString1 addAttribute:NSStrikethroughStyleAttributeName
value:[NSNumber
numberWithInteger:NSUnderlinePatternSolid |
NSUnderlineStyleSingle] range:NSMakeRange(0, priceString.length)];

- (NSMutableAttributedString *)setLabelAttriButeString:(NSString *)text andModelLength:(NSInteger)modelLength
{
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString
alloc] initWithString:text];
    [attributedString addAttribute:NSForegroundColorAttributeName
value:[UIColor
orangeColor] range:NSMakeRange(3, modelLength)];

   
    return attributedString;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: