NSString boundingRectWithSize returning unnecessarily tall height

前端 未结 4 1568
盖世英雄少女心
盖世英雄少女心 2021-01-30 18:12

When using [NSString boundingRectWithSize:options:attributes] the size of the rect that is returned is taller than I would expect for certain strings. The height re

4条回答
  •  灰色年华
    2021-01-30 18:55

    You might want to use NSStringDrawingUsesDeviceMetrics in the options. From the docs:

    NSStringDrawingUsesDeviceMetrics

    Use the image glyph bounds (instead of the typographic bounds) when computing layout.

提交回复
热议问题