NSMutableAttributedString 设置字体大小
2018-06-14 本文已影响27人
一个萝卜X个坑
NSMutableAttributedString *dollarAttString = [[NSMutableAttributedString alloc] initWithString:@"374386.346 BTC" attributes:@{NSKernAttributeName:@(2.0f)}];
[dollarAttString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"DINAlternate-Bold" size:34] range:NSMakeRange(0,10)];
[dollarAttString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"DINAlternate-Bold" size:20] range:NSMakeRange(11,3)];
[dollarAttString addAttribute:NSBaselineOffsetAttributeName value:@(10) range:NSMakeRange(11, 3)];