美文网首页
Monsary button label 自动改变宽度适应

Monsary button label 自动改变宽度适应

作者: Albert新荣 | 来源:发表于2019-04-12 11:05 被阅读0次
  self.orderNumLabel = [[UILabel alloc] init];
  self.orderNumLabel.font = Font_s_18;
  self.orderNumLabel.textColor = Color_FFA34C;
  self.orderNumLabel.text = @"0个";
  [self.orderView addSubview:self.orderNumLabel];
  [self.orderNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.orderPaidInNumLab);
        make.left.equalTo(self.orderNumTilteLab.mas_right).offset(32);
        make.height.equalTo(@25);
        //不需要设置宽度,因为后面会设置自动适应
  }];
  //自动适应宽度
  [_orderNumLabel setContentHuggingPriority:UILayoutPriorityRequired     forAxis:UILayoutConstraintAxisHorizontal];

相关文章

网友评论

      本文标题:Monsary button label 自动改变宽度适应

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