// // HomeSchoolCell.m // smartRhino // // Created by niuzhen on 2020/5/16. // Copyright © 2020 tederen. All rights reserved. // #import "HomeSchoolCell.h" @implementation HomeSchoolCell - (void)awakeFromNib { [super awakeFromNib]; self.addressL.layer.cornerRadius = 2.f; self.addressL.layer.masksToBounds = YES; self.addressL.backgroundColor = UIColorHex(0xF4F4F4); self.numL.layer.cornerRadius = 2.f; self.numL.layer.masksToBounds = YES; self.numL.backgroundColor = UIColorHex(0xF4F4F4); self.levelL.layer.cornerRadius = 2.f; self.levelL.layer.masksToBounds = YES; self.levelL.backgroundColor = UIColorHex(0xF4F4F4); } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } + (HomeSchoolCell *)configCell0:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifer = @"HomeSchoolCell0"; HomeSchoolCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; if (cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"HomeSchoolCell" owner:nil options:nil] objectAtIndex:0]; } return cell; } + (HomeSchoolCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifer = @"HomeSchoolCell1"; HomeSchoolCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; if (cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"HomeSchoolCell" owner:nil options:nil] objectAtIndex:1]; } return cell; } - (void)setDataModel:(HomeSubItemModel *)model { [self.imagV sd_setImageWithURL:[NSURL URLWithString:model.ImageUrl] placeholderImage:kPlaceHolderImage]; self.titleL.text = model.Name; self.subTitleL.text = model.ExtendLableName; if ([model.LableName isKindOfClass:[NSArray class]]) { NSArray * array = model.LableName; if (array.count == 3) { self.addressL.text = array[0]; self.numL.text = array[1]; self.levelL.text = array[2]; } }else if([model.LableName isKindOfClass:[NSString class]]){ NSString * str = model.LableName; NSArray *array = [str componentsSeparatedByString:@","]; self.addressL.text = array[0]; self.numL.text = array[1]; self.levelL.text = array[2]; } self.addW.constant = [self addPlaceLabel:self.addressL]; self.numW.constant = [self addPlaceLabel:self.numL]; self.levelW.constant = [self addPlaceLabel:self.levelL]; } - (void)setDataIndexModel:(HomeSubItemModel *)model searchText:(NSString *)text { [self.imagV sd_setImageWithURL:[NSURL URLWithString:model.ImageUrls] placeholderImage:kPlaceHolderImage]; self.titleL.attributedText = [ZYCTool checkOfString:model.Title withSearchText:text withColor:UIColorHex(0xFF5252)]; self.addressL.text = @"北京"; self.numL.text = @"特级教师36人"; self.levelL.text = @"小学、初中"; self.subTitleL.hidden = YES; self.subContant.constant = 0.f; self.subTopContant.constant = 0.f; self.subBottomContant.constant = 0.f; self.addW.constant = [self addPlaceLabel:self.addressL]; self.numW.constant = [self addPlaceLabel:self.numL]; self.levelW.constant = [self addPlaceLabel:self.levelL]; } - (CGFloat)addPlaceLabel:(UILabel *)label { CGFloat W = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 18)].width + 16; return W; } @end