标签:
label 加下划线
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 100, 300, 100)];
label.backgroundColor = [UIColor redColor];
label.numberOfLines = 3;
NSMutableAttributedString *content = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"您的待办业务条fasdfasdfosadfjasdkljfklasjklfjasdlkjfklasdjklfjalskdjflkadsj"]];
NSRange contentRange = {0,[content length]};
[content addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:contentRange];
label.attributedText = content;
[self.view addSubview:label];
设置 大小不同的字体
NSString * stra = [NSString stringWithFormat:@"0 %.2lf 0",[straaa doubleValue]];
NSMutableAttributedString * str = [[NSMutableAttributedString alloc] initWithString:stra];
[str addAttribute:NSFontAttributeName value: kFontSize_24 range:NSMakeRange(0, 2)];
[str addAttribute:NSFontAttributeName value: kFontSize_100 range:NSMakeRange(2, str.length - 4)];
[str addAttribute:NSFontAttributeName value: kFontSize_24 range:NSMakeRange(str.length - 2, 2)];
[str addAttribute:NSForegroundColorAttributeName value: kColorBackground range:NSMakeRange(str.length - 2, 2)];
lable1.attributedText = str;
标签:
原文地址:http://www.cnblogs.com/isItOk/p/5334356.html