简体   繁体   中英

How to adjust font size to fit height (not width) in swift 3

label.minimumScaleFactor works very well to fit the font to the width.

However the font size, for alphabet such as "I", is typically larger than other letters such as "H". This makes the design very weird.

I need help to fit the font to the label height. Any solutions/functions/class that I can adopt?

Swift 3...

label.minimumScaleFactor = 0.1    //you need
label.adjustsFontSizeToFitWidth = true    
label.lineBreakMode = .byClipping
label.numberOfLines = 0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM