JXMyServiceCell.m 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. //
  2. // JXMyServiceCell.m
  3. // shiku_im
  4. //
  5. // Created by 123 on 2020/5/15.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JXMyServiceCell.h"
  9. @interface JXMyServiceCell()
  10. @property (nonatomic,weak) UIImageView *backIMG;
  11. @property (nonatomic,weak) UIImageView *leftIMG;
  12. @property (nonatomic,weak) UILabel *leftLab;
  13. @property (nonatomic,weak) UILabel *rightL;
  14. @property (nonatomic,weak) UILabel *timeL;
  15. @end
  16. @implementation JXMyServiceCell
  17. - (void)awakeFromNib {
  18. [super awakeFromNib];
  19. // Initialization code
  20. }
  21. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  22. if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  23. UIImageView *backIMG=[[UIImageView alloc]init];
  24. // backIMG.backgroundColor=kRGBColor(33, 133, 88);
  25. // backIMG.contentMode=UIViewContentModeScaleAspectFill;
  26. backIMG.image=[UIImage imageNamed:@"kefuzhu"];
  27. [self.contentView addSubview:backIMG];
  28. self.backIMG=backIMG;
  29. [backIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.top.mas_equalTo(0);
  31. make.left.mas_equalTo(20);
  32. make.right.mas_equalTo(-20);
  33. make.height.mas_equalTo(100);
  34. }];
  35. UIImageView *leftIMG=[[UIImageView alloc]init];
  36. leftIMG.image=[UIImage imageNamed:@"kefuzhuCall"];
  37. [backIMG addSubview:leftIMG];
  38. self.leftIMG=leftIMG;
  39. [leftIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.top.mas_equalTo(8);
  41. make.left.mas_equalTo(15);
  42. }];
  43. UILabel *leftLab=[[UILabel alloc]init];
  44. leftLab.text=@"主线客服";
  45. leftLab.textColor=[UIColor whiteColor];
  46. leftLab.font=[UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
  47. [backIMG addSubview:leftLab];
  48. self.leftLab=leftLab;
  49. [leftLab mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.centerY.mas_equalTo(leftIMG.mas_centerY);
  51. make.left.mas_equalTo(leftIMG.mas_right).mas_offset(10);
  52. }];
  53. UILabel *rightL=[[UILabel alloc]init];
  54. rightL.text=@"Main Customer Support";
  55. rightL.textColor=[UIColor whiteColor];
  56. rightL.font=[UIFont systemFontOfSize:13 weight:UIFontWeightRegular];
  57. [backIMG addSubview:rightL];
  58. self.rightL=rightL;
  59. [rightL mas_makeConstraints:^(MASConstraintMaker *make) {
  60. make.top.mas_equalTo(leftIMG.mas_bottom).mas_offset(8);
  61. make.left.mas_equalTo(15);
  62. }];
  63. UILabel *timeL=[[UILabel alloc]init];
  64. timeL.text=@"7*24小时专线服务 贴心至上";
  65. timeL.textColor=[UIColor whiteColor];
  66. timeL.font=[UIFont systemFontOfSize:13 weight:UIFontWeightRegular];
  67. [backIMG addSubview:timeL];
  68. self.timeL=timeL;
  69. [timeL mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.top.mas_equalTo(rightL.mas_bottom).mas_offset(8);
  71. make.left.mas_equalTo(15);
  72. }];
  73. UIImageView *rightIMG=[[UIImageView alloc]init];
  74. rightIMG.image=[UIImage imageNamed:@"youjiantouM"];
  75. [backIMG addSubview:rightIMG];
  76. [rightIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  77. make.centerY.mas_equalTo(backIMG.mas_centerY);
  78. make.right.mas_equalTo(-15);
  79. }];
  80. }
  81. return self;
  82. }
  83. + (instancetype)cellWithTableView:(UITableView *)tableView
  84. {
  85. static NSString *ID = @"JXMyServiceCell";
  86. JXMyServiceCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  87. if (!cell) {
  88. cell = [[JXMyServiceCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
  89. cell.selectionStyle=UITableViewCellSelectionStyleNone;
  90. }
  91. // cell.layer.cornerRadius=8;
  92. // cell.layer.masksToBounds=YES;
  93. cell.backgroundColor=[UIColor clearColor];
  94. return cell;
  95. }
  96. -(void)setModeL:(StatusesModel *)modeL{
  97. _modeL=modeL;
  98. self.backIMG.image=[UIImage imageNamed:modeL.image];
  99. self.leftIMG.image=[UIImage imageNamed:modeL.leftIMG];
  100. self.leftLab.text=modeL.text;
  101. self.rightL.text=modeL.subtile;
  102. self.timeL.text=modeL.contet;
  103. }
  104. -(void)setFrame:(CGRect)frame{
  105. frame.origin.y+=20;
  106. frame.size.height-=20;
  107. [super setFrame:frame];
  108. }
  109. @end