扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
直接看代码:
创新互联从2013年创立,先为顺庆等服务建站,顺庆等地企业,进行企业商务咨询服务。为顺庆企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
UILabel *label = [[UILabelalloc]initWithFrame:CGRectMake(10,70,300,200)];
label.numberOfLines = 0;
label.backgroundColor = [UIColorcolorWithRed:235/255.0green:235/255.0blue:235/255.0alpha:1];
//------
NSMutableAttributedString *text = [[NSMutableAttributedStringalloc]initWithString:@"1321313123211273127318273819273817381738713712837173812731837128371297319737131719371273187328193721731793\n"];
//设置字体颜色
[textaddAttribute:NSForegroundColorAttributeNamevalue:[UIColorredColor]range:NSMakeRange(0, text.length)];
//设置缩进、行距
NSMutableParagraphStyle *style = [[NSMutableParagraphStylealloc]init];
style.headIndent = 30;//缩进
style.firstLineHeadIndent =0;
style.lineSpacing = 10;//行距
[textaddAttribute:NSParagraphStyleAttributeNamevalue:stylerange:NSMakeRange(0, text.length)];
//------
//------
NSMutableAttributedString *text2 = [[NSMutableAttributedStringalloc]initWithString:@"eqeqeuqoeuquequeqeqwuequeqoueqowueqoueqoshfkahfksdafhkalhfkdshf"];
//设置字体颜色
[text2addAttribute:NSForegroundColorAttributeNamevalue:[UIColorblueColor]range:NSMakeRange(0, text2.length)];
//设置缩进、行距
NSMutableParagraphStyle *style2 = [[NSMutableParagraphStylealloc]init];
style2.headIndent = 0;
style2.firstLineHeadIndent =20;
style2.lineSpacing = 5;
[text2addAttribute:NSParagraphStyleAttributeNamevalue:style2range:NSMakeRange(0, text2.length)];
//------
[textappendAttributedString:text2];
label.attributedText = text;
[self.view addSubview:label];
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流