我尝试使用自动布局以编程方式布局视图,每次尝试将子视图固定到右边缘时,子视图都会消失。
我的布局是这样的:
---------------------
- label1 label2 -
- -
---------------------
我尝试了以下限制:
[insetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(55.0)-[label1]" options:0 metrics:nil views:viewsDictionary]];
[insetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-(29.0)-[label1]" options:0 metrics:nil views:viewsDictionary]];
[insetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(55.0)-[label2]" options:0 metrics:nil views:viewsDictionary]];
[insetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"[label2]|" options:0 metrics:nil views:viewsDictionary]];
最后一个约束是否可能实际上将label2的右边缘固定到其超视图的左边缘?