Swift - UILabel 文本显示不正确

Swift - UILabel text not displayed correctly

我不知道为什么我的 UILabel 没有正确显示,而是 Swift 缩短了它,如下图所示:

这就是我创建 label 和两个 lines:

的方式
let oderLabel: UILabel = {
    let v = UILabel()
    v.translatesAutoresizingMaskIntoConstraints = false
    v.font = UIFont(name: "AvenirNext-DemiBold", size: 15)
    v.textColor = .white
    v.textAlignment = .center
    v.text = "ODER"
    return v
}()

let lineLeft: UIImageView = {
    let v = UIImageView()
    v.translatesAutoresizingMaskIntoConstraints = false
    v.image = UIImage(named: "line")
    return v
}()

let lineRight: UIImageView = {
    let v = UIImageView()
    v.translatesAutoresizingMaskIntoConstraints = false
    v.image = UIImage(named: "line")
    return v
}()

还有我的constraints

    oderLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
    oderLabel.bottomAnchor.constraint(equalTo: weiterButton.bottomAnchor, constant: 40).isActive = true
    
    lineLeft.centerYAnchor.constraint(equalTo: oderLabel.centerYAnchor).isActive = true
    lineLeft.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 30).isActive = true
    lineLeft.trailingAnchor.constraint(equalTo: oderLabel.leadingAnchor).isActive = true
    
    lineRight.centerYAnchor.constraint(equalTo: oderLabel.centerYAnchor).isActive = true
    lineRight.leadingAnchor.constraint(equalTo: oderLabel.trailingAnchor).isActive = true
    lineRight.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -30).isActive = true

我想要的只是将 label 居中并让两个 lines 旁边有一点点 space。这应该在所有 iPhone 尺寸上正确显示。我现在在这上面太久了..

这应该是一个 1 分钟的任务,所以我可能有些误解。如果有人能在这里帮助我,我将非常感激:)

向 oderLabel 添加适当大小的宽度锚点可能会成功。