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

转自: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展示不同字体字符串)