// // FireAlarmCell.m // Haishenghai-master // // Created by GG on 2019/1/10. // Copyright © 2019年 Haishenghai intelligence network technology. All rights reserved. // #import "FireAlarmCell.h" #define ScreenWidth [UIScreen mainScreen].bounds.size.width #define ScreenHeight [UIScreen mainScreen].bounds.size.height @implementation FireAlarmCell -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { _nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, ScreenWidth-20, 25)]; _nameLabel.textAlignment = NSTextAlignmentLeft; [self.contentView addSubview:_nameLabel]; //四个标题和图片 for (int i=0; i<6; i++) { //本来宽是50 _titleLabel= [[UILabel alloc]init]; _timeLabel.backgroundColor = [UIColor redColor]; _titleLabel.frame = CGRectMake(20+(80)*(i/6), 25+(20+1)*(i%6), 80, 20); NSArray *titles = @[@"区域名:",@"火 警:",@"编 号:",@"位 置:",@"时 间:",@"地 址:"]; _titleLabel.text = titles[i]; _titleLabel.font = [UIFont systemFontOfSize:14]; [self.contentView addSubview:_titleLabel]; } _deployLabel = [[UILabel alloc]init]; // _deployLabel.backgroundColor = [UIColor grayColor]; _deployLabel.frame = CGRectMake(80, 25, 200, 20); _deployLabel.font = [UIFont systemFontOfSize:14]; [self.contentView addSubview:_deployLabel]; _typeLabel = [[UILabel alloc]init]; // _typeLabel.backgroundColor = [UIColor grayColor]; _typeLabel.frame = CGRectMake(80, 46, 200, 20); _typeLabel.font = [UIFont systemFontOfSize:14]; [self.contentView addSubview:_typeLabel]; _numberLabel = [[UILabel alloc]init]; // _numberLabel.backgroundColor = [UIColor grayColor]; _numberLabel.frame = CGRectMake(80, 67, 200, 20); _numberLabel.font = [UIFont systemFontOfSize:14]; [self.contentView addSubview:_numberLabel]; _locationLabel = [[UILabel alloc]init]; // _locationLabel.backgroundColor = [UIColor grayColor]; _locationLabel.frame = CGRectMake(80, 88, ScreenWidth-100, 20); _locationLabel.font = [UIFont systemFontOfSize:14]; [self.contentView addSubview:_locationLabel]; _timeLabel = [[UILabel alloc]init]; // _timeLabel.backgroundColor = [UIColor grayColor]; _timeLabel.frame = CGRectMake(80, 109, ScreenWidth-100, 20); _timeLabel.font = [UIFont systemFontOfSize:14]; [self.contentView addSubview:_timeLabel]; _adressLabel = [[UILabel alloc]init]; // _adressLabel.backgroundColor = [UIColor grayColor]; _adressLabel.frame = CGRectMake(80, 130, ScreenWidth-100, 20); _adressLabel.font = [UIFont systemFontOfSize:14]; [self.contentView addSubview:_adressLabel]; _sureBtn =[UIButton buttonWithType:UIButtonTypeCustom]; _sureBtn.frame = CGRectMake(ScreenWidth-100, 40, 80, 44); [_sureBtn setTitle:@"我知道了" forState:UIControlStateNormal]; _sureBtn.backgroundColor =[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1]; _sureBtn.layer.cornerRadius = 10; [self.contentView addSubview:_sureBtn]; } return self; } -(void)setModel:(FireNoticeModel *)model{ _model =model; if ([model.ifRead isEqualToString:@"1"]) { _sureBtn.hidden =YES; }else{ _sureBtn.hidden =NO; } } - (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