UIFont *font = [UIFont systemFontOfSize:32];
CGFloat pointSize = font.pointSize;
CGFloat capHeight = font.capHeight;
CGFloat xHeight = font.xHeight;
CGFloat lineHeight = font.lineHeight;
CGFloat leading = font.leading;
CGFloat ascender = font.ascender;
NSLog(@"pointSize = %@", @(pointSize)); <span style="white-space:pre"> </span>//32
NSLog(@"ascender = %@", @(ascender)); //30.464
NSLog(@"capHeight = %@", @(capHeight)); //22.848
NSLog(@"xHeight = %@", @(xHeight)); //16.544
NSLog(@"lineHeight = %@", @(lineHeight));<span style="white-space:pre"> </span>//38.176
NSLog(@"leading = %@", @(leading)); //38.176
iOS UIFont 初识
最新推荐文章于 2020-12-30 20:41:03 发布
本文深入探讨了iOS开发中UIFont类的使用,详细解析了pointSize、ascender、capHeight、xHeight、lineHeight、leading和ascender等关键属性,并通过实际代码展示了如何获取并打印这些属性的值。
1169

被折叠的 条评论
为什么被折叠?



