macOS:按钮类型

 

    for (int i = 0; i < 10; i++) {
        for (int j = 1; j < 16; j++) {
            NSButton *btn = [[NSButton alloc]init];
            [btn setButtonType:i];
            [btn setBezelStyle:j];
            btn.title = @"btn";
            [self.view addSubview:btn];
            [btn mas_makeConstraints:^(MASConstraintMaker *make) {
                make.leading.mas_equalTo(i*55 + 150);
                make.width.height.mas_equalTo(44);
            }];
            if (j==1) {
                array = [NSMutableArray array];
                [array addObject:btn];
                [btn mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.top.mas_equalTo(70);
                }];
            }else{
                [array addObject:btn];
                [btn mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.top.mas_equalTo(array[j-2].mas_bottom);
                }];
            }
        }
    }

 

 

 

posted on 2018-11-21 11:04  leonlincq  阅读(326)  评论(0编辑  收藏  举报