YOUPAILZLiveBoardCycleViewCell.m 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. //
  2. // YOUPAILZLiveBoardCycleViewCell.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/7/23.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZLiveBoardCycleViewCell.h"
  9. @interface YOUPAILZLiveBoardCycleViewCell()
  10. @property (nonatomic,weak) UIButton *youpaiptotalMoneyBgBtn;
  11. @property (nonatomic,weak) UILabel *youpaiptotalMoneyL;
  12. @property (nonatomic,weak) UIButton *youpaipgapMoneyBgBtn;
  13. @property (nonatomic,weak) UILabel *youpaipgapMoneyDescL;
  14. @property (nonatomic,weak) UILabel *youpaipgapMoneyL;
  15. @property (nonatomic,weak) UIButton *youpaipnoBgBtn;
  16. @property (nonatomic,weak) UILabel *youpaipnoL;
  17. @end
  18. @implementation YOUPAILZLiveBoardCycleViewCell
  19. - (instancetype)initWithFrame:(CGRect)frame{
  20. if (self = [super initWithFrame:frame]) {
  21. [self youpaifinitUI];
  22. }
  23. return self;
  24. }
  25. - (void)youpaifinitUI{
  26. UIButton *youpaiptotalMoneyBgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  27. youpaiptotalMoneyBgBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f];
  28. youpaiptotalMoneyBgBtn.layer.cornerRadius = 10.0f;
  29. youpaiptotalMoneyBgBtn.hidden = YES;
  30. youpaiptotalMoneyBgBtn.clipsToBounds = YES;
  31. [youpaiptotalMoneyBgBtn addTarget:self action:@selector(youpaifbtnClick) forControlEvents:UIControlEventTouchUpInside];
  32. [self.contentView addSubview:youpaiptotalMoneyBgBtn];
  33. self.youpaiptotalMoneyBgBtn = youpaiptotalMoneyBgBtn;
  34. [youpaiptotalMoneyBgBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.top.bottom.offset(0.0f);
  36. }];
  37. UIImageView *totalMoneyImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_ic_user_show_zuanshi11"]];
  38. [youpaiptotalMoneyBgBtn addSubview:totalMoneyImgV];
  39. [totalMoneyImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.left.offset(5.0f);
  41. make.centerY.equalTo(youpaiptotalMoneyBgBtn);
  42. make.size.mas_offset(CGSizeMake(12.0f, 12.0f));
  43. }];
  44. UILabel *youpaiptotalMoneyL = [[UILabel alloc] init];
  45. youpaiptotalMoneyL.font = LCFont(11.0f);
  46. youpaiptotalMoneyL.textColor = [UIColor whiteColor];
  47. [youpaiptotalMoneyBgBtn addSubview:youpaiptotalMoneyL];
  48. self.youpaiptotalMoneyL = youpaiptotalMoneyL;
  49. [youpaiptotalMoneyL mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.left.equalTo(totalMoneyImgV.mas_right).offset(2.0f);
  51. make.right.offset(-5.0f);
  52. make.top.bottom.offset(0.0f);
  53. }];
  54. UIButton *youpaipgapMoneyBgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  55. youpaipgapMoneyBgBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f];
  56. youpaipgapMoneyBgBtn.layer.cornerRadius = 10.0f;
  57. youpaipgapMoneyBgBtn.hidden = YES;
  58. youpaipgapMoneyBgBtn.clipsToBounds = YES;
  59. [youpaipgapMoneyBgBtn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
  60. [self.contentView addSubview:youpaipgapMoneyBgBtn];
  61. self.youpaipgapMoneyBgBtn = youpaipgapMoneyBgBtn;
  62. [youpaipgapMoneyBgBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  63. make.left.top.bottom.offset(0.0f);
  64. }];
  65. UILabel *youpaipgapMoneyDescL = [[UILabel alloc] init];
  66. youpaipgapMoneyDescL.font = LCFont(11.0f);
  67. youpaipgapMoneyDescL.textColor = [UIColor whiteColor];
  68. [youpaipgapMoneyBgBtn addSubview:youpaipgapMoneyDescL];
  69. self.youpaipgapMoneyDescL = youpaipgapMoneyDescL;
  70. [youpaipgapMoneyDescL mas_makeConstraints:^(MASConstraintMaker *make) {
  71. make.left.offset(5.0f);
  72. make.top.bottom.offset(0.0f);
  73. }];
  74. UIImageView *gapMoneyImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_ic_user_show_zuanshi11"]];
  75. [youpaipgapMoneyBgBtn addSubview:gapMoneyImgV];
  76. [gapMoneyImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  77. make.left.equalTo(youpaipgapMoneyDescL.mas_right).offset(0.0f);
  78. make.centerY.equalTo(youpaipgapMoneyBgBtn);
  79. make.size.mas_offset(CGSizeMake(12.0f, 12.0f));
  80. }];
  81. UILabel *youpaipgapMoneyL = [[UILabel alloc] init];
  82. youpaipgapMoneyL.font = LCFont(11.0f);
  83. youpaipgapMoneyL.textColor = [UIColor whiteColor];
  84. [youpaipgapMoneyBgBtn addSubview:youpaipgapMoneyL];
  85. self.youpaipgapMoneyL = youpaipgapMoneyL;
  86. [youpaipgapMoneyL mas_makeConstraints:^(MASConstraintMaker *make) {
  87. make.left.equalTo(gapMoneyImgV.mas_right).offset(2.0f);
  88. make.right.offset(-5.0f);
  89. make.top.bottom.offset(0.0f);
  90. }];
  91. UIButton *youpaipnoBgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  92. youpaipnoBgBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f];
  93. youpaipnoBgBtn.layer.cornerRadius = 10.0f;
  94. youpaipnoBgBtn.hidden = YES;
  95. youpaipnoBgBtn.clipsToBounds = YES;
  96. [youpaipnoBgBtn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
  97. [self.contentView addSubview:youpaipnoBgBtn];
  98. self.youpaipnoBgBtn = youpaipnoBgBtn;
  99. [youpaipnoBgBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  100. make.left.top.bottom.offset(0.0f);
  101. }];
  102. UILabel *noL = [[UILabel alloc] init];
  103. noL.font = LCFont(11.0f);
  104. noL.textColor = HexColorFromRGB(0xFFDD8D);
  105. [youpaipnoBgBtn addSubview:noL];
  106. self.youpaipnoL = noL;
  107. [noL mas_makeConstraints:^(MASConstraintMaker *make) {
  108. make.left.offset(14.0f);
  109. make.right.offset(-14.0f);
  110. make.top.bottom.offset(0.0f);
  111. }];
  112. }
  113. - (void)youpaifreloadWithModel:(LZLiveAnchorRankInfoContentModel *)model type:(NSString *)type{
  114. self.youpaipnoBgBtn.hidden = YES;
  115. self.youpaiptotalMoneyBgBtn.hidden = YES;
  116. self.youpaipgapMoneyBgBtn.hidden = YES;
  117. if ([type isEqual:@"no"]) {
  118. self.youpaipnoBgBtn.hidden = NO;
  119. self.youpaipnoL.text = model.youpaipval;
  120. }
  121. if ([type isEqual:@"totalMoney"]) {
  122. self.youpaiptotalMoneyBgBtn.hidden = NO;
  123. self.youpaiptotalMoneyL.text = model.youpaipval;
  124. }
  125. if ([type isEqual:@"gapMoney"]) {
  126. self.youpaipgapMoneyBgBtn.hidden = NO;
  127. self.youpaipgapMoneyDescL.text = model.youpaipdetail;
  128. self.youpaipgapMoneyL.text = model.youpaipval;
  129. }
  130. }
  131. - (void)youpaifbtnClick{
  132. if (self.youpaipclickBlock != nil) {
  133. self.youpaipclickBlock();
  134. }
  135. }
  136. @end