这是一些代码:
UIView *c = [[UIView alloc] initWithFrame:CGRectZero];
[self addSubview:c];
c.translatesAutoresizingMaskIntoConstraints = NO;
c. backgroundColor = [UIColor lightGrayColor];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[c(>=600)]-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(c)]] ;
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[c]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(c)]] ;![enter image description here][1]
为什么它最终看起来像这样?我的 superView 有什么问题吗?
这是我的包含视图的设置方式: