编程约束切断了我标签的底部

Programmatic constraints cut the bottom of my label off

我有一个带有根 UITableViewCell 和子 UILabel 的 Nib 文件,我使用编程约束 运行 锚定了

        lblAccountItemTitle.translatesAutoresizingMaskIntoConstraints = false
        lblAccountItemTitle.topAnchor.constraint(lessThanOrEqualTo: self.topAnchor, constant: 16).isActive = true
        lblAccountItemTitle.bottomAnchor.constraint(lessThanOrEqualTo: self.bottomAnchor, constant: -16).isActive = true
        lblAccountItemTitle.leadingAnchor.constraint(equalTo: imgAccountItemLeft.trailingAnchor, constant: 16).isActive = true
        lblAccountItemTitle.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -32).isActive = true
        lblAccountItemTitle.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true

此外,我注意到底部锚点越短,文本剪裁越少

如何在仍然保持相等的 16 垂直填充的同时消除剪裁?

both 图像和标签底部锚点从 equalTo 更改为 lessThanOrEqualTo

lblAccountItemTitle.bottomAnchor.constraint(lessThanOrEqualTo: self.bottomAnchor, constant: -16).isActive = true

我以编程方式将标签固定到单元格而不是 Content View

self.topAnchor

应该是

self.contentView.topAnchor