1
我可以在ios中为UILable和UIButton使用Kerning自定义字体吗?ios:确定自定义字体
下面的方法不起作用。 Kerning适用于系统字体,但不适用于自定义字体。有人可以帮助解决问题吗?
NSMutableAttributedString *attributedString =
[[NSMutableAttributedString alloc] initWithString:text attributes:
@{
NSFontAttributeName : [UIFont fontWithName:@"BebasNeue Bold" size:25],
NSForegroundColorAttributeName : [UIColor redColor]
}];
[attributedString addAttribute:NSKernAttributeName
value:[NSNumber numberWithFloat:kerning]
range:NSMakeRange(0, [text length])];
[self setAttributedText:attributedString];