I'm trying to find the height of a single line of text using Text Kit. The Calculating Text Height documentation says
Note: You don’t need to use this technique to find the height of a single line of text. The
NSLayoutManager
methoddefaultLineHeightForFont:
returns that value. The default line height is the sum of a font’s tallest ascender, plus the absolute value of its deepest descender, plus its leading.
However, when I checked the NSLayoutManager Class Reference (and also testing in Xcode) I didn't see a defaultLineHeightForFont:
method. Why is that? Is there an alternative?
Notes:
- I'm not trying to set the line height.
- There are ways to do this apparently that do not use Text Kit. However, since I already have my Text Kit stack set up and the documentation seems to indicate that it is possible, I would like to use Text Kit.
- I prefer Swift answers but Objective-C is ok, too.
Update
I did not realize that the documentation I linked to was for OS X until I read @JoshCaswell's comment. I am specifically looking for how to do this in iOS.