开发者

Measure size of each char in an NSString

We 开发者_运维技巧have [NSString sizeWithFont:] which returns the size of the entire string.

What about getting an array of the sizes of each individual character within the string?

How would you do that (besides tokenizing the string and calling sizeWithFont for each)?

Best, Vance


You should be able to get size information about individual glyphs (note though that those don't always map one-to-one with individual characters in a string) by using the Core Graphics function CGFontGetGlyphBBoxes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜