// // TerminalListCell.m // LN_School // // Created by EchoShacolee on 2017/8/3. // Copyright © 2017年 Danson. All rights reserved. // #import "TerminalListCell.h" @implementation TerminalListCell +(instancetype)cellForTableView:(UITableView *)tableView{ TerminalListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID"]; if (!cell) { cell = [[[NSBundle mainBundle]loadNibNamed:@"TerminalListCell" owner:nil options:nil]lastObject]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } return cell; } -(void)setDic:(NSDictionary *)dic{ self.carNum.text = dic[@"TCO_LICNUM"]; CGFloat x = [self.carNum.text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}].width+10; self.carNum.width = x>150?150:x; self.carNum.width = x<80?80:x; BOOL isOnline = [dic[@"TDI_IS_CONNECT"] integerValue] == 1; self.status.textColor = isOnline ? [UIColor darkGrayColor] : [UIColor lightGrayColor]; self.status.text = isOnline ? @"在线":@"不在线"; self.type.textColor = KContentTextColor; NSString *subTitle = @""; switch ([dic[@"TDI_TERMTYPE"] integerValue]) { case 1: subTitle = @"车载计程计时终端"; break; case 2: subTitle = @"课堂教学计时终端"; break; case 3: subTitle = @"模拟训练计时终端"; break; case 0: subTitle = @"教练APP设备"; break; case 10: subTitle = @"学员APP设备"; break; default: break; } self.type.text = [NSString stringWithFormat:@"终端类型:%@",subTitle]; BOOL isRegister = [dic[@"TDI_REG_STATUS"] integerValue] == 1; self.registerLab.textColor = isRegister ? KContentTextColor : [UIColor redColor]; self.registerLab.text = isRegister ? @"已注册" : @"未注册"; } - (IBAction)orbitClick:(id)sender { //轨迹 if (self.clickBlock) { self.clickBlock(@1); } } - (IBAction)sendMsgClick:(id)sender { //发送消息 if (self.clickBlock) { self.clickBlock(@2); } } - (IBAction)cancleAlarmClick:(id)sender { //解除警报 if (self.clickBlock) { self.clickBlock(@3); } } - (IBAction)videoClick:(id)sender { //录像 if (self.clickBlock) { self.clickBlock(@4); } } - (IBAction)goMapClick:(id)sender { //点击车牌号 if (self.clickBlock) { self.clickBlock(@5); } } - (void)awakeFromNib { [super awakeFromNib]; self.carNum.textColor = KTitleColor; self.carNum.backgroundColor = RGB_COLOR(247, 196, 5); self.carNum.layer.cornerRadius = 3; self.carNum.layer.masksToBounds = YES; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end