美文网首页
一个Label展示不同字体字符串

一个Label展示不同字体字符串

作者: 爱喝农药de清凉 | 来源:发表于2017-06-01 18:39 被阅读4次

转自:http://www.jianshu.com/p/71489b66b0c3
NSMutableAttributedString * title = [[NSMutableAttributedString alloc] initWithString:@"报名号:"];
NSDictionary * titleAttributes = @{ NSFontAttributeName:[UIFont jk_systemFontOfPxSize:34],NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#333333"],};
[title setAttributes:titleAttributes range:NSMakeRange(0,title.length)];

NSMutableAttributedString * number = [[NSMutableAttributedString alloc] initWithString:@"204370534"];
NSDictionary * numberAttributes = @{NSFontAttributeName:[UIFont jk_systemFontOfPxSize:40],NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#333333"],};
[number setAttributes:numberAttributes range:NSMakeRange(0,number.length)];

[title appendAttributedString:number];

registerMumberLabel.attributedText = title;

相关文章

网友评论

      本文标题:一个Label展示不同字体字符串

      本文链接:https://www.haomeiwen.com/subject/lswefxtx.html