// // WD_DetailSchCell.m // LNManager // // Created by EchoShacolee on 2017/6/8. // Copyright © 2017年 lee. All rights reserved. // #import "WD_DetailSchCell.h" @interface WD_DetailSchCell () { UIImageView *_headImgV; UILabel *_schNameLab; UILabel *_levelLab; UILabel *_farenManLab; UILabel *_dqQxLab; UILabel *_cNumLab; UILabel *_connectManLab; UILabel *_connectTelLab; UIView *_view; UIView *_bottomView; } @end @implementation WD_DetailSchCell +(WD_DetailSchCell *)cellForTableView:(UITableView *)tableView{ WD_DetailSchCell * cell = [tableView dequeueReusableCellWithIdentifier:@"WD_DetailSchCell"]; if (!cell) { cell = [[WD_DetailSchCell alloc]initWithStyle:0 reuseIdentifier:@"WD_DetailSchCell"]; } return cell; } -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.tintColor = COLOR_THEME; _headImgV = [[UIImageView alloc]init]; [self.contentView addSubview:_headImgV]; _view = [UIView new]; _view.backgroundColor = KBackGroundColor; [self.contentView addSubview:_view]; // _bottomView = [UIView new]; // _bottomView.backgroundColor = KBackGroundColor; // [self.contentView addSubview:_bottomView]; // NSMutableArray *mArr = [NSMutableArray new]; for (int i=0; i<7; i++) { UILabel *lab = [[UILabel alloc]init]; lab.font = [UIFont systemFontOfSize:14]; [mArr addObject:lab]; [self.contentView addSubview:lab]; } _schNameLab = mArr[0]; _levelLab = mArr[1]; _farenManLab = mArr[2]; _dqQxLab = mArr[3]; _cNumLab = mArr[4]; _connectManLab = mArr[5]; _connectTelLab = mArr[6]; _levelLab.textAlignment = NSTextAlignmentRight; _cNumLab.textAlignment = NSTextAlignmentRight; _connectTelLab.textAlignment = NSTextAlignmentRight; _schNameLab.font = [UIFont systemFontOfSize:16]; _schNameLab.textColor = COLOR_THEME; } return self; } -(void)setDic:(NSDictionary *)dic{ if (_dic != dic) { [_headImgV sd_setImageWithURL:[NSURL URLWithString:dic[@"TIS_IMG"]] placeholderImage:[UIImage imageNamed:@"willDo_default"]]; _schNameLab.text = dic[@"TSI_SHORTNAME"]; NSString *status = [NSString stringWithFormat:@"%@",dic[@"TSI_LEVEL"]]; NSString *levelStr = @"暂无"; switch ([status integerValue]) { case 1: levelStr = @"一级"; break; case 2: levelStr = @"二级"; break; case 3: levelStr = @"三级"; break; case 4: levelStr = @"四级"; break; default: break; } _levelLab.text = [@"分类等级:" stringByAppendingString:levelStr]; _farenManLab.text = [NSString stringWithFormat:@"法人:%@",dic[@"TSI_LEGAL"]]; _dqQxLab.text = [NSString stringWithFormat:@"所属地区:%@ %@",dic[@"TSI_DQMC"],dic[@"TSI_QXMC"]]; _cNumLab.text = [NSString stringWithFormat:@"经营范围:%@",dic[@"TSI_BUSISCOPE"]]; _connectManLab.text = [NSString stringWithFormat:@"联系人:%@",dic[@"TSI_CONTACT"]]; _connectTelLab.text =[NSString stringWithFormat:@"联系电话:%@",dic[@"TSI_PHONE"]]; } } -(void)layoutSubviews{ [super layoutSubviews]; CGFloat wid = self.width; CGFloat x,y,w,h; x = 0; w = wid; y = 0; h = 20; _view.frame = setDIYFrame; x = 10; y = 30; w = 80; h = 70; _headImgV.frame = setDIYFrame; // _headImgV.center = CGPointMake(40, 69); x += w + 10; w = wid - x - 20; h = 25; _schNameLab.frame = setDIYFrame; CGFloat ff = [_schNameLab sizeThatFits:CGSizeMake(MAXFLOAT, h)].width; x += ff; w -= ff; _levelLab.frame = setDIYFrame; x -= ff; w += ff; y += h; _farenManLab.frame = setDIYFrame; ff = [_farenManLab.text widthForFont:16];// x += ff; w -= ff; _cNumLab.frame = setDIYFrame; x -= ff; w += ff; y += h; _dqQxLab.frame = setDIYFrame; x = 10; w = wid - 30; y += h; _connectManLab.frame = setDIYFrame; _connectTelLab.frame = setDIYFrame; // x = -50; // w = wid+50; // y +=10+h; // h = 10; // _bottomView.frame = setDIYFrame; } - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end