// // CarCell.m // jiaPeiC // // Created by apple on 15/12/23. // Copyright © 2015年 JCZ. All rights reserved. // #import "CarCell.h" @implementation CarCell - (void)awakeFromNib { [super awakeFromNib]; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; } -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { UILabel* label; lblCtype = label; label = [UILabel new]; [self addSubview:label]; lblCtype = label; label = [UILabel new]; [self addSubview:label]; lblSname = label; label = [UILabel new]; [self addSubview:label]; titSname = label; CGFloat font = Font16; [self.textLabel setFont:[UIFont scaleSize:font]]; [self.detailTextLabel setFont:[UIFont scaleSize:font]]; [lblSname setFont:[UIFont scaleSize:font]]; [lblCtype setFont:[UIFont scaleSize:font]]; [self.textLabel setTextColor:contentTextColor]; [self.detailTextLabel setTextColor:contentTextColor]; [lblSname setTextColor:contentTextColor]; [lblCtype setTextColor:contentTextColor]; // [titSname setTextColor:contentTextColor]; } return self; } +(id)cellForTabelView:(UITableView *)tableView { id cell = [tableView dequeueReusableCellWithIdentifier:@"CarCell"]; if (!cell) { cell = [[CarCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"CarCell"]; [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; } return cell; } -(void)setModel:(NSDictionary *)model { [self.textLabel setText:[@"车牌号码:" stringByAppendingString:model[@"CI_CAR_NUM"]]]; [self.detailTextLabel setText:[@"发动机号:" stringByAppendingString:model[@"CI_ENGINE_NUM"]]]; [lblCtype setText:[@"培训车型:" stringByAppendingString:model[@"CI_PERMIT_DRIVE_CAR_TYPE"]]]; [lblSname setText:[@"所属驾校:" stringByAppendingString:model[@"CI_SCHOOL_NAME"]]]; // [lblCtype setText:model[@""]]; } -(void)layoutSubviews { [super layoutSubviews]; CGFloat x,y,w,h; x = 20; w = self.width - x*2; h = 30; y = 0; [self.textLabel setFrame:CGRectMake(x, y, w, h)]; y += h; [self.detailTextLabel setFrame:CGRectMake(x, y, w, h)]; y += h; [lblSname setFrame:CGRectMake(x, y, w, h)]; y += h; [lblCtype setFrame:CGRectMake(x, y, w, h)]; } @end CGFloat CarCellHeight() { return 4 * 30; }