SnapKit / Masonry

Harness the power of AutoLayout NSLayoutConstraints with a simplified, chainable and expressive syntax. Supports iOS and OSX Auto Layout
MIT License
18.06k stars 3.15k forks source link

equalTo(@[@10,@30]),What is the meaning of using an array in parentheses of equalTo #580

Open iOSHCX opened 4 years ago

iOSHCX commented 4 years ago

i want to konw In what scene will we use Array in equalTo()

cntrump commented 3 years ago

Example: redView.height = greenView.height = blueView.height

[greenView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.height.equalTo(redView.mas_height);
    make.height.equalTo(blueView.mas_height);
}];

[redView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.height.equalTo(@[greenView, blueView]); // pass array of views
}];

[blueView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.height.equalTo(@[greenView.mas_height, redView.mas_height]); // pass array of attributes
}];