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

2017-06-01  本文已影响4人  爱喝农药de清凉

转自: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;
上一篇 下一篇

猜你喜欢

热点阅读