XYRedPacketDetailGiftCell.m 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // XYRedPacketDetailGiftCell.m
  3. // Timi
  4. //
  5. // Created by gy on 2021/11/22.
  6. //
  7. #import "XYRedPacketDetailGiftCell.h"
  8. @interface XYRedPacketDetailGiftCell(){
  9. }
  10. @property (nonatomic, strong) UIView *contentView1;
  11. @property (nonatomic, strong) UIImageView *imgView;
  12. @property (nonatomic, strong) UILabel *nameLab;
  13. @property (nonatomic, strong) UILabel *priceLab;
  14. @end
  15. @implementation XYRedPacketDetailGiftCell
  16. - (void)reload:(YQLiveCoinGiftCoinModel *)info{
  17. [self contentView1];
  18. [self.imgView sd_setImageWithURL:UrlForString(info.image) placeholderImage:placeholderImage()];
  19. self.nameLab.text = info.name;
  20. self.priceLab.text = [NSString stringWithFormat:@"价值%d%@",info.addScoreValue,info.giftPriceTypeName];
  21. }
  22. #pragma mark — lazy
  23. - (UIView *)contentView1{
  24. if (_contentView1 == nil) {
  25. _contentView1 = [[UIView alloc] initWithFrame:CGRectZero];
  26. _contentView1.backgroundColor = [UIColor colorWithHexString:@"#D4A223" alpha:0.05];
  27. [self.contentView addSubview:_contentView1];
  28. [_contentView1 mas_makeConstraints:^(MASConstraintMaker *make) {;
  29. make.edges.equalTo(self.contentView);
  30. }];
  31. kViewRadius(_contentView1, 8);
  32. }
  33. return _contentView1;
  34. }
  35. - (UIImageView *)imgView{
  36. if (_imgView == nil) {
  37. _imgView = [[UIImageView alloc] init];
  38. _imgView.image = [UIImage imageNamed:@"icon-redpacket"];
  39. _imgView.contentMode = UIViewContentModeScaleAspectFill;
  40. _imgView.clipsToBounds = YES;
  41. [self.contentView addSubview:_imgView];
  42. [_imgView mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.centerX.equalTo(self.contentView.mas_centerX).offset(0);
  44. make.top.equalTo(self.contentView.mas_top).offset(4);
  45. make.width.offset(56);
  46. make.height.offset(56);
  47. }];
  48. }
  49. return _imgView;
  50. }
  51. - (UILabel *)nameLab{
  52. if (_nameLab == nil) {
  53. _nameLab = [[UILabel alloc] init];
  54. _nameLab.text = @"";
  55. _nameLab.textAlignment = NSTextAlignmentCenter;
  56. _nameLab.textColor = [UIColor colorWithHexString:@"#303133" alpha:1];
  57. _nameLab.font = [UIFont fontWithName:kPFSCFont size:12];
  58. [_nameLab sizeToFit];
  59. [self.contentView addSubview:_nameLab];
  60. [_nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.centerX.equalTo(self.contentView.mas_centerX).offset(0);
  62. make.top.equalTo(self.imgView.mas_bottom).offset(4);
  63. }];
  64. }
  65. return _nameLab;
  66. }
  67. - (UILabel *)priceLab{
  68. if (_priceLab == nil) {
  69. _priceLab = [[UILabel alloc] init];
  70. _priceLab.text = @"";
  71. _priceLab.textAlignment = NSTextAlignmentCenter;
  72. _priceLab.textColor = [UIColor colorWithHexString:@"#909399" alpha:1];
  73. _priceLab.font = [UIFont fontWithName:kPFSCFont size:8];
  74. [_priceLab sizeToFit];
  75. [self.contentView addSubview:_priceLab];
  76. [_priceLab mas_makeConstraints:^(MASConstraintMaker *make) {
  77. make.centerX.equalTo(self.contentView.mas_centerX).offset(0);
  78. make.top.equalTo(self.nameLab.mas_bottom).offset(1);
  79. }];
  80. }
  81. return _priceLab;
  82. }
  83. @end