转载自:https://blog.csdn.net/chenyong05314/article/details/70846538
1.UIFont的API里面有哪些属性
// Font attributes
@property(nonatomic,readonly,strong) NSString *familyName;
@property(nonatomic,readonly,strong) NSString *fontName;
@property(nonatomic,readonly) CGFloat pointSize;
@property(nonatomic,readonly) CGFloat ascender;
@property(nonatomic,readonly) CGFloat descender;
@property(nonatomic,readonly) CGFloat capHeight;
@property(nonatomic,readonly) CGFloat xHeight;
@property(nonatomic,readonly) CGFloat lineHeight NS_AVAILABLE_IOS(4_0);
@property(nonatomic,readonly) CGFloat leading;
2.看图解释:
2.1 familyName:会把字体名字分成几部分,用空格隔开。
2.2 fontName:表示的字体的名字
2.3 pointSize:就是字体的大小,要获取字体大小就用这个属性。
2.4 ascender和descender意义很明确,就不说了。
2.5 capHeight :表示最高的字符的高度。
2.6 xHeight :表示最低的字符的高度。
2.7 lineHeight : 是行高,当你要计算这些字所占用的高度的时候,要用这个属性。












网友评论