// // DeveceListCell.m // Haishenghai-master // // Created by GG on 2019/1/10. // Copyright © 2019年 Haishenghai intelligence network technology. All rights reserved. // #import "DeveceListCell.h" #define ScreenWidth [UIScreen mainScreen].bounds.size.width #define ScreenHeight [UIScreen mainScreen].bounds.size.height @implementation DeveceListCell -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { _stateLabel = [[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-50, 25, 44, 25)]; _stateLabel.text = @"故障"; _stateLabel.textColor = [UIColor orangeColor]; [self.contentView addSubview:_stateLabel]; //五个标题 for (int i=0; i<5; i++) { _titleLabel= [[UILabel alloc]init]; _titleLabel.frame = CGRectMake(20+80*(i/5), 10+(25+1)*(i%5), 80, 25); NSArray *titles = @[@"设备编号:",@"信 号 源:",@"区 域:",@"详细地址:",@"安装位置:"]; _titleLabel.text = titles[i]; // _titleLabel.backgroundColor = [UIColor redColor]; _titleLabel.font = [UIFont systemFontOfSize:16]; [self.contentView addSubview:_titleLabel]; } // UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, 113.5, ScreenWidth, 0.5)]; // line.backgroundColor = [UIColor colorWithRed:227/255.0 green:227/255.0 blue:227/255.0 alpha:1]; // [self.contentView addSubview:line]; _deveNumberLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 10, ScreenWidth-160, 25)]; _deveNumberLabel.font = [UIFont systemFontOfSize:16]; [self.contentView addSubview:_deveNumberLabel]; _signalLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 36, ScreenWidth-160, 25)]; _signalLabel.text = @"电信平台"; _signalLabel.font = [UIFont systemFontOfSize:16]; [self.contentView addSubview:_signalLabel]; _deplementLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 62, ScreenWidth-120, 25)]; _deplementLabel.font = [UIFont systemFontOfSize:16]; [self.contentView addSubview:_deplementLabel]; _locationLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 88, ScreenWidth-120, 25)]; _locationLabel.font = [UIFont systemFontOfSize:16]; [self.contentView addSubview:_locationLabel]; _d_lationLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 114, ScreenWidth-120, 25)]; _d_lationLabel.font = [UIFont systemFontOfSize:16]; [self.contentView addSubview:_d_lationLabel]; UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, 147, ScreenWidth, 3)]; line.backgroundColor = [UIColor colorWithRed:227/255.0 green:227/255.0 blue:227/255.0 alpha:1]; [self.contentView addSubview:line]; } return self; } //在这里添加frame和约束 //-(void)layoutSubviews{ // // [super layoutSubviews]; // // } //-(void)setModel:(deveceListModel *)model{ // _model =model; // _deveNumberLabel.text = model.deviceid; //} - (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