NSArray *arry = @[@"销售",@"淘宝运营",@"夜班",@"京东",@"电话销售",@"网店运营",@"兼职",@"司机",@"美工",@"会计"];

    CGFloat preRight = 20;

    CGFloat preTop = 40;

    for (NSInteger i = 0; i<arry.count ; i++) {

        

        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];

        

        btn.tag = 100+i;

        

        [btn setTitle:arry[i] forState:UIControlStateNormal];

        btn.titleLabel.font = NORMALFONT;

        [btn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];

        [btn setBackgroundColor:TABLEVIEWBCOLOR];

        

            CGSize btnSize = [btn.titleLabel.text sizeWithAttributes:@{NSFontAttributeName:btn.titleLabel.font}];

        

        btn.frame = CGRectMake(preRight, preTop, btnSize.width+10, btnSize.height);

        

        if (btn.right > ScreenWidth-40) {

            btn.left = 20;

            btn.top = btn.bottom+15;

        }

        preRight = btn.right + 15;

        preTop = btn.top;

        [self addSubview:btn];