当前位置:   article > 正文

IOS Label下划线 中划线_nsunderlinestyle中划线

nsunderlinestyle中划线

/**

 *  ZY  CODE

 *

 *  Label设置下划线

 */

+(void)setLabelUnderline:(UILabel *)label{

    NSMutableAttributedString *content = [[NSMutableAttributedString alloc] initWithString:label.text];

    NSRange contentRange = {0, [content length]};

    [content addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:contentRange];

    label.attributedText = content;

}


/**

 *  ZY  CODE

 *

 *  Label设置中划线

 */

+(void)setLabelUnderline:(UILabel *)label{

    NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};

    NSMutableAttributedString *content = [[NSMutableAttributedString alloc]initWithString:label.text attributes:attribtDic];

    label.attributedText = content;

}


  


本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/729126
推荐阅读
相关标签
  

闽ICP备14008679号