第十八篇、OC_使用OAStackView FDStackView (第三方框架)可以使用在ios 7及以上的版本

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);
    }];
posted on 2017-01-16 10:46  久冬不雨  阅读(433)  评论(0编辑  收藏  举报