I'm trying to get the exactly baseline of a text of a UILabel.
label.frame.maxY
returns the max y of the box of the UILabel.
But what I really want is the maxY of the position of the text.
Ignore the "button". I just searched this image from google. I know how to get what the first returns (maxY), but I want to know how to get the second one (where the dashline is under the text).
Thanks for any help!
You can achieve this quite simply :
let baselineY = label.frame.origin.y + label.font.ascender;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With