label添加下划线

    UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 100)];
    myLabel.textAlignment = NSTextAlignmentCenter;
    myLabel.center = self.view.center;
    NSMutableAttributedString *content = [[NSMutableAttributedString alloc] initWithString:@"iOS开发交流群:119783156"];
    NSRange contentRange = {0, [content length]};
    [content addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle]range:contentRange];
    myLabel.attributedText = content;
    [self.view addSubview:myLabel];
    

运行结果:



转载请注明出处http://blog.csdn.net/chen_gp_x

展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 撸撸猫 设计师: 设计师小姐姐
应支付0元
点击重新获取
扫码支付

支付成功即可阅读