简体   繁体   中英

UiLabel text get cut off from Top

i have a Expandable label that shows Bengali font, but it gets cut off from top, as you can in the image: 在此处输入图像描述

Here how i declared the properties:

@IBOutlet private weak var descriptionLabel: ExpandableLabel!

I tried different method but didn't help, Example:

descriptionLabel.lineBreakMode = .byCharWrapping
descriptionLabel.sizeToFit()
descriptionLabel.baselineAdjustment = .none

Someone please suggest how to solve that by not cutting off the text from top.

Constraints: 在此处输入图像描述

descriptionLabel.clipsToBounds = false

This solves the problem

the label's (vertical) content compression resistance priority was not high enough, setting it to required (1000) fixed it.

or a quick hack

 override public func layoutSubviews() {
    super.layoutSubviews()
    var frame = self. descriptionLabel.frame
    frame.size.height += 1.0
    self.descriptionLabel.frame = frame
}

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