MessageTableCell.m 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. //
  2. // MessageTableCell.m
  3. // Haishenghai-master
  4. //
  5. // Created by GG on 2019/1/5.
  6. // Copyright © 2019年 Haishenghai intelligence network technology. All rights reserved.
  7. //
  8. #import "MessageTableCell.h"
  9. #define ScreenWidth [UIScreen mainScreen].bounds.size.width
  10. #define ScreenHeight [UIScreen mainScreen].bounds.size.height
  11. @implementation MessageTableCell
  12. - (void)awakeFromNib {
  13. [super awakeFromNib];
  14. // Initialization code
  15. }
  16. -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  17. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  18. _nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, ScreenWidth-20, 25)];
  19. // _nameLabel.text = @"独立式烟雾探测报警器";
  20. _nameLabel.textAlignment = NSTextAlignmentLeft;
  21. [self.contentView addSubview:_nameLabel];
  22. _image =[[UIImageView alloc]init];
  23. // WithImage:[UIImage imageNamed:@"hsh_home_normal"]];
  24. _image.frame = CGRectMake(10, 30, 30, 30);
  25. [self.contentView addSubview:_image];
  26. //区域名label
  27. UILabel *nameTitle = [[UILabel alloc]init];
  28. nameTitle.frame = CGRectMake(45, 25, 60, 20);
  29. nameTitle.text = @"区域名:";
  30. nameTitle.font = [UIFont systemFontOfSize:14];
  31. [self.contentView addSubview:nameTitle];
  32. //创建传值的label
  33. _placeLabel = [[UILabel alloc]init];
  34. _placeLabel.frame = CGRectMake(105, 25, ScreenWidth-105, 20);
  35. // _locationLabel.text = @"西部科技园。。。。。。";
  36. _placeLabel.font = [UIFont systemFontOfSize:14];
  37. _placeLabel.textAlignment = NSTextAlignmentLeft;
  38. [self.contentView addSubview:_placeLabel];
  39. _stateLabel = [[UILabel alloc]init];
  40. _stateLabel.frame = CGRectMake(45, 45, ScreenWidth-45, 20);
  41. // _stateLabel.text = @"火警恢复正常";
  42. _stateLabel.font = [UIFont systemFontOfSize:14];
  43. _stateLabel.textAlignment = NSTextAlignmentLeft;
  44. [self.contentView addSubview:_stateLabel];
  45. //线
  46. UIView *lineView = [[UIView alloc]init];
  47. lineView.backgroundColor = [UIColor colorWithRed:227/255.0 green:227/255.0 blue:227/255.0 alpha:1];
  48. lineView.frame = CGRectMake(0, 65, ScreenWidth, 1);
  49. [self.contentView addSubview:lineView];
  50. //四个标题和图片
  51. for (int i=0; i<4; i++) {
  52. UIImageView *imageView = [[UIImageView alloc]init];
  53. NSArray *imageArr = @[@"hsh_news_number",@"hsh_news_location",@"hsh_news_time",@"hsh_news_address"];
  54. imageView.frame = CGRectMake(20+(20)*(i/4), 68+(20+1)*(i%4), 15, 15);
  55. imageView.image = [UIImage imageNamed:[imageArr objectAtIndex:i]];
  56. [self.contentView addSubview:imageView];
  57. UILabel *titlelab= [[UILabel alloc]init];
  58. titlelab.frame = CGRectMake(45+(50)*(i/4), 65+(20+1)*(i%4), 50, 20);
  59. NSArray *titles = @[@"编号:",@"位置:",@"时间:",@"地址:"];
  60. titlelab.text = titles[i];
  61. titlelab.font = [UIFont systemFontOfSize:14];
  62. [self.contentView addSubview:titlelab];
  63. }
  64. _checkButton = [UIButton buttonWithType:UIButtonTypeCustom];
  65. // [_checkButton setBackgroundImage:[UIImage imageNamed:@"hsh_news_unaudited"] forState:UIControlStateNormal];
  66. _checkButton.frame = CGRectMake(ScreenWidth-45, 65, 45, 45);
  67. // _checkView.backgroundColor = [UIColor greenColor];
  68. [self.contentView addSubview:_checkButton];
  69. _numberLabel = [[UILabel alloc]init];
  70. _numberLabel.frame = CGRectMake(80, 65, 200, 20);
  71. // _numberLabel.text = @"123456";
  72. _numberLabel.font = [UIFont systemFontOfSize:14];
  73. _numberLabel.textAlignment = NSTextAlignmentLeft;
  74. [self.contentView addSubview:_numberLabel];
  75. _locationLabel = [[UILabel alloc]init];
  76. _locationLabel.frame = CGRectMake(80, 86, ScreenWidth-60, 20);
  77. // _locationLabel.text = @"千千万万群多";
  78. _locationLabel.font = [UIFont systemFontOfSize:14];
  79. _locationLabel.textAlignment = NSTextAlignmentLeft;
  80. [self.contentView addSubview:_locationLabel];
  81. _timelabel = [[UILabel alloc]init];
  82. _timelabel.frame = CGRectMake(80, 107, ScreenWidth-60, 20);
  83. // _timelabel.text = @"2018219e";
  84. _timelabel.font = [UIFont systemFontOfSize:14];
  85. _timelabel.textAlignment = NSTextAlignmentLeft;
  86. [self.contentView addSubview:_timelabel];
  87. _detailLocationLabel = [[UILabel alloc]init];
  88. _detailLocationLabel.frame = CGRectMake(80, 128, ScreenWidth-60, 20);
  89. // _detailLocationLabel.text = @"2018219e";
  90. _detailLocationLabel.font = [UIFont systemFontOfSize:14];
  91. _detailLocationLabel.textAlignment = NSTextAlignmentLeft;
  92. [self.contentView addSubview:_detailLocationLabel];
  93. }
  94. return self;
  95. }
  96. //这里接数据模型用
  97. //-(void)setModel:(PlaceViewModel *)model{
  98. // _model = model;
  99. // self.nameLabel.text = model.title;
  100. //}
  101. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  102. [super setSelected:selected animated:animated];
  103. // Configure the view for the selected state
  104. }
  105. @end