// // WD_DetailChangeCell.m // LNManager // // Created by EchoShacolee on 2017/6/13. // Copyright © 2017年 lee. All rights reserved. // #import "WD_DetailChangeCell.h" #import "NSString+ex.h" @interface WD_DetailChangeCell () { UIView *_view; UIView *_bottomView; } @property (strong, nonatomic) UILabel *nameLab; @property (strong, nonatomic) UILabel *outSchLab; @property (strong, nonatomic) UILabel *inSchLab; @property (strong, nonatomic) UILabel *timelab; @property (strong, nonatomic) UILabel *reasonLab; @end @implementation WD_DetailChangeCell +(WD_DetailChangeCell *)cellForTableView:(UITableView *)tableView{ WD_DetailChangeCell * cell = [tableView dequeueReusableCellWithIdentifier:@"WD_DetailChangeCell"]; if (!cell) { cell = [[WD_DetailChangeCell alloc]initWithStyle:0 reuseIdentifier:@"WD_DetailChangeCell"]; } return cell; } -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.tintColor = COLOR_THEME; NSMutableArray *mArr = [NSMutableArray new]; for (int i=0; i<5; i++) { UILabel *lab = [[UILabel alloc]init]; lab.font = [UIFont systemFontOfSize:14]; [mArr addObject:lab]; [self.contentView addSubview:lab]; } _nameLab = mArr[0]; _outSchLab = mArr[1]; _inSchLab = mArr[2]; _timelab = mArr[3]; _reasonLab = mArr[4]; _view = [UIView new]; _view.backgroundColor = KBackGroundColor; [self.contentView addSubview:_view]; _bottomView = [UIView new]; _bottomView.backgroundColor = KBackGroundColor; [self.contentView addSubview:_bottomView]; _reasonLab.numberOfLines = 0; self.nameLab.textColor = COLOR_THEME; } return self; } -(void)setDic:(NSDictionary *)dic{ _dic = dic; _nameLab.text = dic[@"STUDNETNAME"]; _outSchLab.text = [NSString stringWithFormat:@"转出学校:%@",dic[@"OUTSCHOOLNAME"]]; _inSchLab.text = [NSString stringWithFormat:@"转入学校:%@",dic[@"INSCHOOLNAME"]]; _timelab.text = [NSString stringWithFormat:@"申请时间:%@",dic[@"SCS_IN_OPERATE_TIME"]]; _reasonLab.text = [NSString stringWithFormat:@"申请原因:%@",dic[@"SCS_CHANGE_REASON"]]; } -(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 = wid-20; y = 20; h = 17; bd = 10; _nameLab.frame = setDIYFrame; y += h+bd; _outSchLab.frame = setDIYFrame; y += h+bd; _inSchLab.frame = setDIYFrame; y += h+bd; _timelab.frame = setDIYFrame; y += h+bd; h = [_reasonLab.text heightForWid:w Font:14]; _reasonLab.frame = setDIYFrame; x = -50; w = wid+50; y +=10+h; h = 10; _bottomView.frame = setDIYFrame; //165-17 } - (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