// // WD_DetailCarCell.m // LNManager // // Created by EchoShacolee on 2017/6/8. // Copyright © 2017年 lee. All rights reserved. // #import "WD_DetailCarCell.h" @interface WD_DetailCarCell () { UILabel * _rollsRoyce; UILabel * _schLab; UILabel * _addressLab; UILabel * _engNumLab; UILabel * _fraNumLab; UILabel * _licNumLab; UILabel * _perdritypeLab; UIView *_view; UIView *_bottomView; } @end @implementation WD_DetailCarCell +(WD_DetailCarCell *)cellForTableView:(UITableView *)tableView{ WD_DetailCarCell * cell = [tableView dequeueReusableCellWithIdentifier:@"WD_DetailCarCell"]; if (!cell) { cell = [[WD_DetailCarCell alloc]initWithStyle:0 reuseIdentifier:@"WD_DetailCarCell"]; } return cell; } -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.tintColor = COLOR_THEME; _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]; } _rollsRoyce = mArr[0]; _addressLab = mArr[1]; _fraNumLab = mArr[2]; _engNumLab = mArr[3]; _licNumLab = mArr[4]; _schLab = mArr[5]; _perdritypeLab = mArr[6]; _rollsRoyce.textAlignment = NSTextAlignmentRight; _engNumLab.textAlignment = NSTextAlignmentRight; _licNumLab.backgroundColor = RGB_COLOR(247, 196, 5); _licNumLab.textAlignment = NSTextAlignmentCenter; // _rollsRoyce.textColor = COLOR_THEME; } return self; } -(void)setDic:(NSDictionary *)dic{ _dic = dic; _licNumLab.text = dic[@"TCO_LICNUM"]; _rollsRoyce.text = dic[@"TCO_BRAND"]; _schLab.text = [NSString stringWithFormat:@"所属驾校:%@",dic[@"SCHOOLNAME"]]; _addressLab.text = [NSString stringWithFormat:@"所属地区:%@%@",dic[@"DQMC"],dic[@"QXMC"]]; _engNumLab.text = [NSString stringWithFormat:@"发动机号:%@",dic[@"TCO_ENGNUM"]]; if ([dic[@"TCO_FRANUM"] length] != 0) { _fraNumLab.text =[NSString stringWithFormat:@"车架号:%@",dic[@"TCO_FRANUM"]]; } _perdritypeLab.text = [NSString stringWithFormat:@"培训车型:%@",dic[@"TCO_PERDRITYPE"]]; } -(void)layoutSubviews{ [super layoutSubviews]; CGFloat wid = self.width; CGFloat x,y,w,h,bd; x = -50; w = wid+50; y = 0; h = 10; _view.frame = setDIYFrame; x = 10; w = [_licNumLab.text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}].width+10; y = 20; h = 17; bd = 10; _licNumLab.frame = setDIYFrame; w = wid-20-10; _rollsRoyce.frame = setDIYFrame; y += h+bd; w = [_perdritypeLab.text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}].width; _perdritypeLab.frame = setDIYFrame; w = wid-20; _engNumLab.frame = setDIYFrame; y += h+bd; _schLab.frame = setDIYFrame; y += h+bd; _addressLab.frame = setDIYFrame; x = -50; w = wid+50; y +=10+h; h = 10; _bottomView.frame = setDIYFrame; //138 } - (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