JXMyFeedCell.m 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //
  2. // JXMyFeedCell.m
  3. // shiku_im
  4. //
  5. // Created by 123 on 2020/5/23.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JXMyFeedCell.h"
  9. @interface JXMyFeedCell()
  10. @property (nonatomic,weak) UIImageView *leftIMG;
  11. @property (nonatomic,weak) UILabel *rightL;
  12. @property (nonatomic,weak) UILabel *subTitleL;
  13. @end
  14. @implementation JXMyFeedCell
  15. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  16. [super setSelected:selected animated:animated];
  17. if (selected) {
  18. self.rightL.textColor=kRGBColor(222, 29, 19);
  19. self.leftIMG.image=[UIImage imageNamed:@"yjduigou"];
  20. }else{
  21. self.rightL.textColor=kRGBColor51;
  22. self.leftIMG.image=[UIImage imageNamed:@""];
  23. }
  24. }
  25. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  26. if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  27. UILabel *rightL=[[UILabel alloc]init];
  28. rightL.text=@"玩彩必看";
  29. rightL.textColor=kRGBColor51;
  30. rightL.font=[UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
  31. [self.contentView addSubview:rightL];
  32. self.rightL=rightL;
  33. [rightL mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.centerY.mas_equalTo(self.contentView.mas_centerY);
  35. make.left.mas_equalTo(15);
  36. }];
  37. UIImageView *rightIMG=[[UIImageView alloc]init];
  38. //rightIMG.image=[UIImage imageNamed:@""];
  39. [self.contentView addSubview:rightIMG];
  40. self.leftIMG=rightIMG;
  41. [rightIMG mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.centerY.mas_equalTo(self.contentView.mas_centerY);
  43. make.right.mas_equalTo(-15);
  44. }];
  45. /*
  46. UIView *line_View=[[UIView alloc]init];
  47. line_View.backgroundColor=kRGBColor(246, 246, 246);
  48. [self.contentView addSubview:line_View];
  49. line_View.hidden=NO;
  50. self.line_View=line_View;
  51. [line_View mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.bottom.mas_equalTo(self.contentView.mas_bottom);
  53. make.left.mas_equalTo(15);
  54. make.right.mas_equalTo(-15);
  55. make.height.mas_equalTo(1);
  56. }];
  57. */
  58. }
  59. return self;
  60. }
  61. + (instancetype)cellWithTableView:(UITableView *)tableView
  62. {
  63. static NSString *ID = @"JXMyFeedCell";
  64. JXMyFeedCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  65. if (!cell) {
  66. cell = [[JXMyFeedCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
  67. cell.selectionStyle=UITableViewCellSelectionStyleNone;
  68. //cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
  69. }
  70. return cell;
  71. }
  72. - (void)cellWModel:(JXMyModel *)model index:(NSIndexPath *)index{
  73. _model=model;
  74. if (index.row==0) {
  75. self.rightL.textColor=kRGBColor(222, 29, 19);
  76. self.leftIMG.image=[UIImage imageNamed:@"yjduigou"];
  77. }else{
  78. self.rightL.textColor=kRGBColor51;
  79. self.leftIMG.image=[UIImage imageNamed:@""];
  80. }
  81. }
  82. -(void)setModel:(JXMyModel *)model{
  83. _model=model;
  84. self.rightL.text=model.name;
  85. }
  86. @end