None of the methods listed below give the exact visible bounds of a text in Cocoa. How do we obtain that?
NSString
'sboundingRectWithSize:options:attributes:
NSAttributedString
'sboundingRectWithSize:options:
NSLayoutManager
'susedRectForTextContainer:
To illustrate this, here's a screenshot of the result of using the second method above as shown in this sample code snippet.
See Question&Answers more detail:os