(void)setCellInfo:(PropertyClassifiedsModel *)model
{
//时间所在的view
UIView *timeView = [[UIView alloc] init];
[self.contentView addSubview:timeView];
[timeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView.mas_top);
make.left.equalTo(self.contentView.mas_left);
make.size.mas_equalTo(CGSizeMake(Width, 54));
}];
UIImageView *ima = [[UIImageView alloc] init];
[self.contentView addSubview:ima];
self.notificationLabelContents = [[UILabel alloc] init];
[ima addSubview:self.notificationLabelContents];
ima.backgroundColor = [UIColor whiteColor];
[ima mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(timeView.mas_bottom);
make.left.equalTo(self.notificationImageView.mas_right).offset(10);
make.right.equalTo(self.contentView.mas_right).offset(-10);
make.height.equalTo(self.notificationLabelContents).offset(20);
}];
//通知的具体内容
// self.notificationLabelContents = [[UILabel alloc] init];
// [ima addSubview:self.notificationLabelContents];
[self.notificationLabelContents mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(ima).with.offset(10);
make.left.equalTo(ima.mas_left).with.offset(10);
make.right.equalTo(ima).with.offset(-10);
make.bottom.equalTo(ima).with.offset(-10);
}];
self.notificationLabelContents.textColor = [UIColor blackColor];
self.notificationLabelContents.font = [UIFont systemFontOfSize:15];
self.notificationLabelContents.text = model.notificationContents;
self.notificationLabelContents.lineBreakMode = UILineBreakModeCharacterWrap;
self.notificationLabelContents.numberOfLines = 0;
CGSize size = [self.notificationLabelContents sizeThatFits:CGSizeMake(self.frame.size.width, MAXFLOAT)];
self.notificationLabelContents.frame = CGRectMake(60, 44, size.width, size.height);
NSLog(@"%f",size.height);
CGRect cellRrect = self.contentView.frame;
cellRrect.size.height = timeView.frame.size.height + ima.frame.size.height;
self.contentView.frame = cellRrect;
}
直接写的预估高度
self.PropertyClassifiedsTableView.rowHeight = UITableViewAutomaticDimension;
self.PropertyClassifiedsTableView.estimatedRowHeight = 350;
self.edgesForExtendedLayout = UIRectEdgeNone;