PHP群:95885625 Hbuilder+MUI群:81989597 站长QQ:634381967
    您现在的位置: 首页 > 开发编程 > iOS开发教程 > 正文

    label 添加下划线和删除线

    作者:张志勇来源:原创浏览:时间:2020-09-30 00:07:50我要评论
    导读:为Label添加下划线(可行) UILabel *label = [[UILabel alloc] initWith :CGRectMake(0, 100, 300, 100)]; label.backgrou...
    为Label添加下划线(可行)     UILabel *label = [[UILabel alloc] initWith :CGRectMake(0, 100, 300, 100)];     label.backgroundColor = [UIColor redColor];     label.numberOfLines = 3;     NSMutableAttributedString *content = [[NSMutableAttributedString alloc]initWithString:@"您的待办业务条fasdfasdfosadfjasdkljfklasjklfjasdlkjfklasdjklfjalskdjflkadsj"];     NSRange contentRange = {0,[content length]};     [content addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:contentRange];          label.attributedText = content;     [self.view addSubview:label];



    就直说删除线  _deletePriceLabel = [[UILabelalloc]initWith :CGRectMake(170, 77, 60, 22)];
        NSAttributedString *attrStr = [[NSAttributedStringalloc] initWithString:@"?88"attributes:@{NSFontAttributeName:[UIFontsystemFontOfSize:12.f],NSForegroundColorAttributeName:[UIColorlightGrayColor],NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle|NSUnderlinePatternSolid)}];     _deletePriceLabel.attributedText = attrStr;     [self addSubview:_deletePriceLabel]; NSFontAttributeName文字大小   NSForegroundColorAttributeName文字颜色 NSStrikethroughStyleAttributeName删除线样式 NSStrikethroughColorAttributeName删除线的颜色

    转载请注明(B5教程网)原文链接:https://b5.mxunkeji.com/content-155-6006-1.html
    相关热词搜索: