DeveceListCell.m 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // DeveceListCell.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 "DeveceListCell.h"
  9. #define ScreenWidth [UIScreen mainScreen].bounds.size.width
  10. #define ScreenHeight [UIScreen mainScreen].bounds.size.height
  11. @implementation DeveceListCell
  12. -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  13. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  14. _stateLabel = [[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-50, 25, 44, 25)];
  15. _stateLabel.text = @"故障";
  16. _stateLabel.textColor = [UIColor orangeColor];
  17. [self.contentView addSubview:_stateLabel];
  18. //五个标题
  19. for (int i=0; i<5; i++) {
  20. _titleLabel= [[UILabel alloc]init];
  21. _titleLabel.frame = CGRectMake(20+80*(i/5), 10+(25+1)*(i%5), 80, 25);
  22. NSArray *titles = @[@"设备编号:",@"信 号 源:",@"区 域:",@"详细地址:",@"安装位置:"];
  23. _titleLabel.text = titles[i];
  24. // _titleLabel.backgroundColor = [UIColor redColor];
  25. _titleLabel.font = [UIFont systemFontOfSize:16];
  26. [self.contentView addSubview:_titleLabel];
  27. }
  28. // UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, 113.5, ScreenWidth, 0.5)];
  29. // line.backgroundColor = [UIColor colorWithRed:227/255.0 green:227/255.0 blue:227/255.0 alpha:1];
  30. // [self.contentView addSubview:line];
  31. _deveNumberLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 10, ScreenWidth-160, 25)];
  32. _deveNumberLabel.font = [UIFont systemFontOfSize:16];
  33. [self.contentView addSubview:_deveNumberLabel];
  34. _signalLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 36, ScreenWidth-160, 25)];
  35. _signalLabel.text = @"电信平台";
  36. _signalLabel.font = [UIFont systemFontOfSize:16];
  37. [self.contentView addSubview:_signalLabel];
  38. _deplementLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 62, ScreenWidth-120, 25)];
  39. _deplementLabel.font = [UIFont systemFontOfSize:16];
  40. [self.contentView addSubview:_deplementLabel];
  41. _locationLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 88, ScreenWidth-120, 25)];
  42. _locationLabel.font = [UIFont systemFontOfSize:16];
  43. [self.contentView addSubview:_locationLabel];
  44. _d_lationLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 114, ScreenWidth-120, 25)];
  45. _d_lationLabel.font = [UIFont systemFontOfSize:16];
  46. [self.contentView addSubview:_d_lationLabel];
  47. UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, 147, ScreenWidth, 3)];
  48. line.backgroundColor = [UIColor colorWithRed:227/255.0 green:227/255.0 blue:227/255.0 alpha:1];
  49. [self.contentView addSubview:line];
  50. }
  51. return self;
  52. }
  53. //在这里添加frame和约束
  54. //-(void)layoutSubviews{
  55. //
  56. // [super layoutSubviews];
  57. //
  58. // }
  59. //-(void)setModel:(deveceListModel *)model{
  60. // _model =model;
  61. // _deveNumberLabel.text = model.deviceid;
  62. //}
  63. - (void)awakeFromNib {
  64. [super awakeFromNib];
  65. // Initialization code
  66. }
  67. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  68. [super setSelected:selected animated:animated];
  69. // Configure the view for the selected state
  70. }
  71. @end