NSMutableAttributedString 富文本删除线的用法

时间:2015-07-15 16:25:35   收藏:0   阅读:144

 

 

#import <UIKit/UIKit.h>


    //价格
    NSString *priceStr = @"99元 剁手价66元";
    NSMutableAttributedString *priceString = [[NSMutableAttributedString alloc] initWithString:priceStr];
    [priceString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12.0f] range:NSMakeRange(0, 3)];
    [priceString addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, 3)];
    [priceString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14.0f] range:NSMakeRange(4, 5)];
    [priceString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithNumber:110] range:NSMakeRange(4, 5)];
    priceLabel.attributedText = priceString;

 

原文:http://www.cnblogs.com/lear/p/4648477.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!