XYRedPacketDrawResultCell.m 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // XYRedPacketDetailGiftCell.m
  3. // Timi
  4. //
  5. // Created by gy on 2021/11/22.
  6. //
  7. #import "XYRedPacketDrawResultCell.h"
  8. @interface XYRedPacketDrawResultCell(){
  9. }
  10. @property (nonatomic, strong) UIImageView *avatarImgView;
  11. @property (nonatomic, strong) UILabel *userNameLab;
  12. @property (nonatomic, strong) UILabel *giftNameLab;
  13. @property (nonatomic, strong) UIImageView *giftImgView;
  14. @end
  15. @implementation XYRedPacketDrawResultCell
  16. - (void)reload:(YQLiveCoinGiftCoinModel *)info{
  17. [self.avatarImgView sd_setImageWithURL:UrlForString(info.image) placeholderImage:placeholderImage()];
  18. self.userNameLab.text = info.name;//#303133 //#FF4D79
  19. self.giftNameLab.text = info.giftPriceTypeName;
  20. [self.giftImgView sd_setImageWithURL:UrlForString(info.image_type) placeholderImage:placeholderImage()];
  21. if (info.select) {
  22. self.userNameLab.textColor = [UIColor colorWithHexString:@"#FF4D79" alpha:1];
  23. }else{
  24. self.userNameLab.textColor = [UIColor colorWithHexString:@"#303133" alpha:1];
  25. }
  26. }
  27. #pragma mark — lazy
  28. - (UIImageView *)avatarImgView{
  29. if (_avatarImgView == nil) {
  30. _avatarImgView = [[UIImageView alloc] init];
  31. _avatarImgView.contentMode = UIViewContentModeScaleAspectFill;
  32. [self.contentView addSubview:_avatarImgView];
  33. [_avatarImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.centerY.equalTo(self.contentView.mas_centerY).offset(0);
  35. make.left.equalTo(self.contentView.mas_left).offset(16);
  36. make.width.offset(24);
  37. make.height.offset(24);
  38. }];
  39. kViewRadius(_avatarImgView, 12);
  40. }
  41. return _avatarImgView;
  42. }
  43. - (UILabel *)userNameLab{
  44. if (_userNameLab == nil) {
  45. _userNameLab = [[UILabel alloc] init];
  46. _userNameLab.text = @"";
  47. _userNameLab.textAlignment = NSTextAlignmentCenter;
  48. _userNameLab.textColor = [UIColor colorWithHexString:@"#303133" alpha:1];
  49. _userNameLab.font = [UIFont fontWithName:kPFSCFont size:12];
  50. [_userNameLab sizeToFit];
  51. [self.contentView addSubview:_userNameLab];
  52. [_userNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
  53. make.centerY.equalTo(self.contentView.mas_centerY).offset(0);
  54. make.left.equalTo(self.avatarImgView.mas_right).offset(4);
  55. }];
  56. }
  57. return _userNameLab;
  58. }
  59. - (UILabel *)giftNameLab{
  60. if (_giftNameLab == nil) {
  61. _giftNameLab = [[UILabel alloc] init];
  62. _giftNameLab.text = @"";
  63. _giftNameLab.textAlignment = NSTextAlignmentCenter;
  64. _giftNameLab.textColor = [UIColor colorWithHexString:@"#FF4D79" alpha:1];
  65. _giftNameLab.font = [UIFont fontWithName:kPFSCFont size:8];
  66. [_giftNameLab sizeToFit];
  67. [self.contentView addSubview:_giftNameLab];
  68. [_giftNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
  69. make.centerY.equalTo(self.contentView.mas_centerY).offset(0);
  70. make.right.equalTo(self.contentView.mas_right).offset(-44);
  71. }];
  72. }
  73. return _giftNameLab;
  74. }
  75. - (UIImageView *)giftImgView{
  76. if (_giftImgView == nil) {
  77. _giftImgView = [[UIImageView alloc] init];
  78. _giftImgView.contentMode = UIViewContentModeScaleAspectFill;
  79. _giftImgView.clipsToBounds = YES;
  80. [self.contentView addSubview:_giftImgView];
  81. [_giftImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  82. make.centerY.equalTo(self.contentView.mas_centerY).offset(0);
  83. make.right.equalTo(self.contentView.mas_right).offset(-16);
  84. make.width.offset(24);
  85. make.height.offset(24);
  86. }];
  87. }
  88. return _giftImgView;
  89. }
  90. @end