UILabel *view1 = [[UILabel alloc]init];
view1.text = @"Label1";
view1.backgroundColor = [UIColor redColor];
UILabel *view2 = [UILabel new];
view2.text = @"";
view2.backgroundColor = [UIColor grayColor];
UILabel *view3 = [UILabel new];
view3.text = @"Label2";
view3.backgroundColor = [UIColor grayColor];
OAStackView *stackView = [[OAStackView alloc]initWithArrangedSubviews:@[view1,view2,view3]];
stackView.axis = UILayoutConstraintAxisHorizontal; // 排列方向
stackView.spacing = 20; // 控件的间距
// 等分
stackView.distribution = OAStackViewDistributionFillEqually;
[self.view addSubview:stackView];
[stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];