UIFont-DynamicFontControl 0.1

UIFont-DynamicFontControl 0.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布上次发布2014年12月

Michael Kral 维护。



  • Michael Kral

UIFont-DynamicFontSize

此类别旨在帮助使用在 iOS7 中引入的动态文本大小。您可以使用自己的字体并调整字体大小。

使用方法

导入头文件

#import "UIFont+DynamicFontControl.h"

使用 UIFontTextStyle 和字体名称初始化动态字体。

UIFont * dynamicFont = [UIFont preferredFontForTextStyle:UIFontTextStyleBody withFontName:@"AmericanTypewriter"];

或者您可以为字体大小设置自己的缩放值。

UIFont * scaledDynamicFont = [UIFont preferredFontForTextStyle:UIFontTextStyleBody withFontName:@"AmericanTypewriter" scale:2.0f];

当前限制

目前受影响的唯一属性是字体大小。例如,我不会为 UIFontTextStyleHeadline 添加粗体属性。

我计划在不久的将来使用 CoreText 更新此类别以修复此问题。