当前位置: 首页 > 工具软件 > OAStackView > 使用案例 >

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

任昊苍
2023-12-01
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);
    }];

转载于:https://www.cnblogs.com/HJQ2016/p/6288786.html

 类似资料: