FireAlarmCell.m 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. //
  2. // FireAlarmCell.m
  3. // Haishenghai-master
  4. //
  5. // Created by GG on 2019/1/10.
  6. // Copyright © 2019年 Haishenghai intelligence network technology. All rights reserved.
  7. //
  8. #import "FireAlarmCell.h"
  9. #define ScreenWidth [UIScreen mainScreen].bounds.size.width
  10. #define ScreenHeight [UIScreen mainScreen].bounds.size.height
  11. @implementation FireAlarmCell
  12. -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  13. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  14. _nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, ScreenWidth-20, 25)];
  15. _nameLabel.textAlignment = NSTextAlignmentLeft;
  16. [self.contentView addSubview:_nameLabel];
  17. //四个标题和图片
  18. for (int i=0; i<6; i++) {
  19. //本来宽是50
  20. _titleLabel= [[UILabel alloc]init];
  21. _timeLabel.backgroundColor = [UIColor redColor];
  22. _titleLabel.frame = CGRectMake(20+(80)*(i/6), 25+(20+1)*(i%6), 80, 20);
  23. NSArray *titles = @[@"区域名:",@"火 警:",@"编 号:",@"位 置:",@"时 间:",@"地 址:"];
  24. _titleLabel.text = titles[i];
  25. _titleLabel.font = [UIFont systemFontOfSize:14];
  26. [self.contentView addSubview:_titleLabel];
  27. }
  28. _deployLabel = [[UILabel alloc]init];
  29. // _deployLabel.backgroundColor = [UIColor grayColor];
  30. _deployLabel.frame = CGRectMake(80, 25, 200, 20);
  31. _deployLabel.font = [UIFont systemFontOfSize:14];
  32. [self.contentView addSubview:_deployLabel];
  33. _typeLabel = [[UILabel alloc]init];
  34. // _typeLabel.backgroundColor = [UIColor grayColor];
  35. _typeLabel.frame = CGRectMake(80, 46, 200, 20);
  36. _typeLabel.font = [UIFont systemFontOfSize:14];
  37. [self.contentView addSubview:_typeLabel];
  38. _numberLabel = [[UILabel alloc]init];
  39. // _numberLabel.backgroundColor = [UIColor grayColor];
  40. _numberLabel.frame = CGRectMake(80, 67, 200, 20);
  41. _numberLabel.font = [UIFont systemFontOfSize:14];
  42. [self.contentView addSubview:_numberLabel];
  43. _locationLabel = [[UILabel alloc]init];
  44. // _locationLabel.backgroundColor = [UIColor grayColor];
  45. _locationLabel.frame = CGRectMake(80, 88, ScreenWidth-100, 20);
  46. _locationLabel.font = [UIFont systemFontOfSize:14];
  47. [self.contentView addSubview:_locationLabel];
  48. _timeLabel = [[UILabel alloc]init];
  49. // _timeLabel.backgroundColor = [UIColor grayColor];
  50. _timeLabel.frame = CGRectMake(80, 109, ScreenWidth-100, 20);
  51. _timeLabel.font = [UIFont systemFontOfSize:14];
  52. [self.contentView addSubview:_timeLabel];
  53. _adressLabel = [[UILabel alloc]init];
  54. // _adressLabel.backgroundColor = [UIColor grayColor];
  55. _adressLabel.frame = CGRectMake(80, 130, ScreenWidth-100, 20);
  56. _adressLabel.font = [UIFont systemFontOfSize:14];
  57. [self.contentView addSubview:_adressLabel];
  58. _sureBtn =[UIButton buttonWithType:UIButtonTypeCustom];
  59. _sureBtn.frame = CGRectMake(ScreenWidth-100, 40, 80, 44);
  60. [_sureBtn setTitle:@"我知道了" forState:UIControlStateNormal];
  61. _sureBtn.backgroundColor =[UIColor colorWithRed:78/255.0 green:105/255.0 blue:255/255.0 alpha:1];
  62. _sureBtn.layer.cornerRadius = 10;
  63. [self.contentView addSubview:_sureBtn];
  64. }
  65. return self;
  66. }
  67. -(void)setModel:(FireNoticeModel *)model{
  68. _model =model;
  69. if ([model.ifRead isEqualToString:@"1"]) {
  70. _sureBtn.hidden =YES;
  71. }else{
  72. _sureBtn.hidden =NO;
  73. }
  74. }
  75. - (void)awakeFromNib {
  76. [super awakeFromNib];
  77. // Initialization code
  78. }
  79. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  80. [super setSelected:selected animated:animated];
  81. // Configure the view for the selected state
  82. }
  83. @end