【发布时间】:2016-01-02 13:33:59
【问题描述】:
我在视图中有两个标签,其中一个标签可以通过用户输入(添加数字)进行更改。约束以编程方式设置,使用视觉格式语言的水平约束如下所示:
"H:|-11-[label1]-[label2(>=30@750)]-10-|"
结果如下:
|[the text in label1...][label2]|
但是当用户将一些数字添加到标签 2 时,它会看起来像:
|[the text in label1...][......]|
我尝试过使用updateConstraintsIfNeeded()、updateConstraints() 和layoutIfNeeded(),但没有任何效果。
这是我在输入额外数字后想要得到的结果:
|[the text in...][extra numbers]|
我做错了什么?一切都以编程方式编码。
【问题讨论】:
标签: ios swift autolayout uilabel nslayoutconstraint