I have 2 UILabel
side-by-side horizontally using auto-layout as following:
adjustsFontSizeToFitWidth = true
On launch everything is fine, when returning from landscape to portrait 1st-Label shrinks to zero width.
Constraints are following:
H:|-0-[1stLabel]
, V:[1stLabel]-0-|
H:[2ndLabel]-0-|
, V:[2ndLabel]-0-|
H:[1stLabel]-(>=1)-[2ndLabel]
将标签1的抗压性优先级设置为1000
我错过了在2nd-Label上设置ContentCompressionResistancePriority的方法:
secondLabel.setContentCompressionResistancePriority(.defaultLow, for:.horizontal)
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.