GromoreDemoAdBasicInfoSelectCell.m 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // ABUDemoAdBasicInfoSelectCell.m
  3. // Ads-Mediation-CN-demo
  4. //
  5. // Created by heyinyin on 2022/1/28.
  6. //
  7. #import "GromoreDemoAdBasicInfoSelectCell.h"
  8. @interface GromoreDemoAdBasicInfoSelectCell ()
  9. @property (nonatomic, strong) UIImageView *image;
  10. @property (nonatomic, strong) UILabel *idLable;
  11. @end
  12. @implementation GromoreDemoAdBasicInfoSelectCell
  13. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  14. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  15. [self initView];
  16. self.selectionStyle = UITableViewCellSelectionStyleNone;
  17. }
  18. return self;
  19. }
  20. - (void)initView {
  21. CGFloat x = 12.f;
  22. UIView *view = [[UIView alloc] initWithFrame:CGRectMake(x, 8, 20, 20)];
  23. _image = [[UIImageView alloc] initWithFrame:CGRectMake(3, 4, 12, 8)];
  24. _idLable = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(view.frame) + x, 7, CGRectGetWidth([UIScreen mainScreen].bounds) - x * 2, 20)];
  25. _idLable.textColor = RQ_MAIN_TEXT_COLOR_1;
  26. _idLable.font = RQRegularFont(16);
  27. _idLable.text = @"广告位";
  28. [view addSubview:_image];
  29. [self.contentView addSubview:_idLable];
  30. [self.contentView addSubview:view];
  31. }
  32. - (void)setCellInfoWithAdType:(NSString *)adType andAdId:(NSString *)adId {
  33. _idLable.text = [NSString stringWithFormat:@"%@ - %@", adType, adId];
  34. }
  35. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  36. [super setSelected:selected animated:animated];
  37. if (selected) {
  38. _image.image = [UIImage imageNamed:@"gromore_selected"];
  39. _image.alpha = 1;
  40. _idLable.alpha = 1;
  41. } else {
  42. _image.image = nil;
  43. _image.alpha = 0.5;
  44. _idLable.alpha = 0.5;
  45. }
  46. }
  47. @end