.usesFontLeading gives a different height

Hey,

When I use boundingRect with String, and supply .usesFontLeading as one of the options, I get an inaccurate height for some reason.

Why is that?

Replies

I couldn't find any information on this, this is what I what I think.

UILabels don't have a NSLayoutManager where the default value for .usesFontLeading is true, if that's true, then this is how it goes:

boundingRect doesn't require the usesFontLeading option in my cause because I'm only using UILabel and not UITextView, bigger code repositories use .usesFontLeading because they either solely rely on UITextView or want to make their apps more inclusive of elements.

That's what I think, I won't mark this post as the answer because there is no proof backing up my hypothesis. If any one of you know why that is the case, then feel free to post your answer.

Hopefully this helps someone.

Cheers.