码迷,mamicode.com
首页 > 其他好文 > 详细

[代码]label增加删除线

时间:2015-12-02 16:15:47      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:

UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(20, 60, 100, 30)];
    [self.view addSubview:lable];
    lable.backgroundColor = [UIColor redColor];
    lable.textAlignment = NSTextAlignmentCenter;
    NSString *oldPrice = @"¥ 999999";
    NSUInteger length = [oldPrice length];
    
    NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:oldPrice];
    [attri addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, length)];
    [attri addAttribute:NSStrikethroughColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(0, length)];
    [lable setAttributedText:attri]; 

[代码]label增加删除线

标签:

原文地址:http://www.cnblogs.com/huaixu/p/5013198.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!