简体   繁体   中英

UILabel: 2 lines text shrinking

By design (!) I have two lines title text which I cannot break:

JustWord
VeryLongWordWithoutSpaces

On big iPhones (6 and 6 Plus) text works great,
but when I test on smaller iPhone (5 or less) it looks like:

JustWord
VeryLongWordWi...

I cannot find a way how to shrink the text in UILabel.
Cutting and truncating are not possible in my situation.

Requirements:
Auto Layout, no Storyboards, Swift 2.0, iOS 8.0+

做到这一点的两种主要方法是设置最小字体大小或最小字体比例。

Please try adjustsFontSizeToFitWidth: property for UIlabel. I have tried this and font is setting in one line and font size is automatically adjust.

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