在我看来,我有3个子视图,一个接一个
------------
|    V1    |
------------
|    V2    |
------------
|    V3    |
------------
现在,V1 - V3 可以根据内容具有不同的高度(甚至高度 0)(我可以计算所需的高度)
------------
|    V1    |
|    V1    |
|    V1    |
------------
------------
|    V3    |
|    V3    |
------------
我玩了几个小时的 IB 约束,但无法正确理解,所以我决定让它纯程序化,但我也遇到了约束问题。
- (void)setupWithContent:(NSDictionary *)content {
    CGFloat width123 = 200.f;
    CGFloat height1 = [content[@"height1"] floatValue];
    CGFloat height2 = [content[@"height2"] floatValue];
    CGFloat height3 = [content[@"height3"] floatValue];
    [self.view addConstraints:...];
    [self.view1 addConstraints:...];
    [self.view2 addConstraints:...];
    [self.view3 addConstraints:...];
}
如何使用程序约束来实现这一点(在程序情况下需要在 IB 中设置什么)