0

我正在使用以下可视格式语言 (VFL) 来设置 UIView 的最大高度。

// this is here to stop the auto layout from reporting that the guides has
// ambiguous layout
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[topGuide]|" options:0 metrics:nil views:views]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[bottomGuide]|" options:0 metrics:nil views:views]];


// center the stop view in the super view, both lines below are needed
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-(>=12)-[stopView(<=400)]-(>=12)-|"
                                                                  options: 0
                                                                  metrics:nil
                                                                    views:views]];
// set the height to a ratio of the width
NSLayoutConstraint *con2 = [NSLayoutConstraint constraintWithItem:stopView
                                                        attribute:NSLayoutAttributeWidth
                                                        relatedBy:0 toItem:stopView
                                                        attribute:NSLayoutAttributeHeight
                                                       multiplier:0.66667f constant:0];
[self.view addConstraint:con2];

但是 VFL 从零开始高度。一旦满足约束,它就会停止并生成以下图像:

高度从零开始.

当我将可视格式字符串更改为@"|-(>=12)-[stopView(<=400,>=100)]-(>=12)-|"从 100 开始的高度并生成以下内容时:

身高从100开始

我可以添加什么 VFL 以使高度从 400 开始并下降直到满足约束?

4

0 回答 0