美文网首页
图片平均分布局ios

图片平均分布局ios

作者: VickyLanLan | 来源:发表于2021-07-08 16:33 被阅读0次
            CGFloat itemW = ((kScreenW -30)-2*Scale(15))/4.0;     NSArray *titles = @[@"浏览记录",@"我的认证",@"我的订单",@"邀请有奖"];     NSArray *imgs = @[@"my_profileFisrt",@"my_profileSecond",@"my_profileThird",@"my_profileFouth"];          for (int i=0; i<titles.count; i++) {         UIButton *btn = [[UIButton alloc]init];         CGFloat btnX = itemW * i + Scale(15);         CGFloat btnY = 0;         btn.frame = CGRectMake(btnX,btnY, itemW, itemW);         btn.tag = 1000 + i;         btn.titleLabel.font = LYFont(Scale(14));         [btn setImage:ImageNamed(imgs[i]) forState:UIControlStateNormal];         [btn setTitle:titles[i] forState:UIControlStateNormal];         [btn setTitleColor:LYHexColor(@"#999999") forState:UIControlStateNormal];         [btn addTarget:self action:@selector(functionBtnClick:) forControlEvents:UIControlEventTouchUpInside];         [self.backgView addSubview:btn];         [btn layoutButtonWithEdgeInsetsStyle:JTButtonEdgeInsetsStyleTop imageTitleSpace:5];     }

    相关文章

      网友评论

          本文标题:图片平均分布局ios

          本文链接:https://www.haomeiwen.com/subject/fmjtpltx.html