简体   繁体   English

UiLabel 文本从顶部被截断

[英]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:我有一个显示孟加拉字体的可扩展 label ,但它从顶部被截断,如图所示: 在此处输入图像描述

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.标签的(垂直)内容压缩阻力优先级不够高,将其设置为必需(1000)已修复。

or a quick hack或快速破解

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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