需求:
在cell中只隐藏label文字,但仍然可以调用,是之后控件依然自适应约束
CGFloat timeLabelH = 0; _timeLabel.text = talkModel.time; // _timeLabel.hidden = talkModel.timeHide; if (!talkModel.timeHide) { timeLabelH = [talkModel.time boundingRectWithSize:CGSizeMake(_timeLabel.frame.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : _timeLabel.font} context:nil].size.height; } [_timeLabel mas_updateConstraints:^(MASConstraintMaker *make) { make.height.equalTo(timeLabelH); }];
网友评论