YMInvitingPrizesIncentivesNotesView.m 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. //
  2. // YMInvitingPrizesIncentivesNotesView.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/3/6.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMInvitingPrizesIncentivesNotesView.h"
  9. #import "YMInvitingPrizesViewModel.h"
  10. @interface YMInvitingPrizesIncentivesNotesView ()
  11. /// 邀请有奖VM
  12. @property (nonatomic, strong) YMInvitingPrizesViewModel *viewModel;
  13. /// 顶部右视图
  14. //@property (nonatomic, strong) UIView *topRightView;
  15. @property (nonatomic, strong) UIImageView *bgImgv;
  16. @property (nonatomic, strong) UIImageView *titleImgv;
  17. ///// 渐变色图片视图
  18. //@property (nonatomic, strong) UIImageView *gradientImageView;
  19. ///// 功能标题标签
  20. //@property (nonatomic, strong) UILabel *functionTitleLb;
  21. /// 底部基础视图
  22. @property (nonatomic, strong) UIView *bottomBaseView;
  23. /// 奖励说明标题标签
  24. //@property (nonatomic, strong) UILabel *incentivesNotesTitleLb;
  25. /// 奖励说明内容标签
  26. @property (nonatomic, strong) UILabel *incentivesNotesContentLb;
  27. ///// 奖励说明提示标签
  28. //@property (nonatomic, strong) UILabel *incentivesNotesTipsLb;
  29. @end
  30. @implementation YMInvitingPrizesIncentivesNotesView
  31. - (void)ym_setupViews{
  32. // [self addSubview:self.topRightView];
  33. // [self.topRightView addSubview:self.gradientImageView];
  34. // [self.topRightView addSubview:self.functionTitleLb];
  35. [self addSubview:self.bottomBaseView];
  36. [self.bottomBaseView addSubview:self.bgImgv];
  37. [self.bottomBaseView addSubview:self.titleImgv];
  38. // [self.bottomBaseView addSubview:self.incentivesNotesTitleLb];
  39. [self.bottomBaseView addSubview:self.incentivesNotesContentLb];
  40. // [self.bottomBaseView addSubview:self.incentivesNotesTipsLb];
  41. [self setNeedsUpdateConstraints];
  42. [self updateConstraintsIfNeeded];
  43. }
  44. - (void)updateConstraints{
  45. // [self.topRightView mas_makeConstraints:^(MASConstraintMaker *make) {
  46. // make.top.equalTo(self);
  47. // make.left.equalTo(self).offset(adapt(15));
  48. // make.right.equalTo(self).offset(adapt(-15));
  49. // make.height.mas_equalTo(adapt(45));
  50. // }];
  51. //
  52. // [self.gradientImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  53. // make.bottom.equalTo(self.topRightView.mas_bottom).offset(adapt(-5));
  54. // make.left.equalTo(self.topRightView).offset(adapt(15));
  55. // make.width.mas_equalTo(adapt(90));
  56. // make.height.mas_equalTo(adapt(15));
  57. // }];
  58. //
  59. // [self.functionTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  60. // make.centerY.equalTo(self.topRightView.mas_centerY);
  61. // make.left.equalTo(self.topRightView).offset(adapt(18));
  62. // }];
  63. [self.bottomBaseView mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.top.equalTo(self).offset(adapt(0));
  65. make.left.equalTo(self).offset(adapt(15));
  66. make.right.equalTo(self).offset(adapt(-15));
  67. make.bottom.equalTo(self);
  68. }];
  69. [self.bgImgv mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.edges.equalTo(self.bottomBaseView);
  71. }];
  72. [self.titleImgv mas_makeConstraints:^(MASConstraintMaker *make) {
  73. make.top.equalTo(self.bottomBaseView).offset(adapt(28));
  74. make.centerX.equalTo(self.bottomBaseView);
  75. make.width.mas_equalTo(adapt(156));
  76. make.height.mas_equalTo(adapt(25));
  77. }];
  78. // [self.incentivesNotesTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  79. // make.top.equalTo(self.bottomBaseView).offset(adapt(31));
  80. // make.left.equalTo(self.bottomBaseView).offset(adapt(12));
  81. // }];
  82. [self.incentivesNotesContentLb mas_makeConstraints:^(MASConstraintMaker *make) {
  83. make.top.equalTo(self.titleImgv.mas_bottom).offset(adapt(16));
  84. make.left.equalTo(self.bottomBaseView).offset(adapt(15));
  85. make.right.equalTo(self.bottomBaseView).offset(adapt(-15));
  86. make.bottom.equalTo(self.bottomBaseView).offset(adapt(-31));
  87. }];
  88. // [self.incentivesNotesTipsLb mas_makeConstraints:^(MASConstraintMaker *make) {
  89. // make.top.equalTo(self.incentivesNotesContentLb.mas_bottom).offset(adapt(10));
  90. // make.left.equalTo(self.bottomBaseView).offset(adapt(12));
  91. // make.right.equalTo(self.bottomBaseView).offset(adapt(-12));
  92. // make.bottom.equalTo(self.bottomBaseView).offset(adapt(-31));
  93. // }];
  94. [super updateConstraints];
  95. }
  96. - (void)ym_bindViewModel:(YMInvitingPrizesViewModel *)viewModel{
  97. if (!viewModel) {
  98. return;
  99. }
  100. _viewModel = viewModel;
  101. RAC(self.incentivesNotesContentLb, attributedText) = RACObserve(self.viewModel, incentivesNotes);
  102. }
  103. //- (UIView *)topRightView{
  104. // if (!_topRightView) {
  105. // _topRightView = [[UIView alloc]init];
  106. // _topRightView.backgroundColor = UIColor.clearColor;
  107. // //[_topRightView addRectCorner:UIRectCornerTopLeft|UIRectCornerTopRight radius:adapt(21)];
  108. // }
  109. // return _topRightView;
  110. //}
  111. //
  112. //
  113. //- (UIImageView *)gradientImageView{
  114. // if (!_gradientImageView) {
  115. // _gradientImageView = [[UIImageView alloc]init];
  116. // _gradientImageView.image = ImageByName(@"ym_inviting_prizes_line_icon");
  117. // }
  118. // return _gradientImageView;
  119. //}
  120. //
  121. //- (UILabel *)functionTitleLb{
  122. // if (!_functionTitleLb) {
  123. // _functionTitleLb = [[UILabel alloc]init];
  124. // _functionTitleLb.font = LCBoldFont(18);
  125. // _functionTitleLb.textColor = HexColorFromRGB(0x333333);
  126. // _functionTitleLb.textAlignment = NSTextAlignmentLeft;
  127. // _functionTitleLb.text = @"邀请奖励";
  128. // }
  129. // return _functionTitleLb;
  130. //}
  131. - (UIImageView *)bgImgv {
  132. if (!_bgImgv) {
  133. _bgImgv = [[UIImageView alloc] init];
  134. UIImage *image = ImageByName(@"ym_inviting_prizes_invitation_reward_bg");
  135. UIEdgeInsets insets = UIEdgeInsetsMake(40, 0, 40, 0); // 上、左、下、右的拉伸边距
  136. // 创建可拉伸的图像
  137. UIImage *stretchableImage = [image resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];
  138. _bgImgv.image = stretchableImage;
  139. }
  140. return _bgImgv;
  141. }
  142. - (UIImageView *)titleImgv {
  143. if (!_titleImgv) {
  144. _titleImgv = [[UIImageView alloc] init];
  145. _titleImgv.image = ImageByName(@"ym_inviting_prizes_invitation_reward_title");
  146. }
  147. return _titleImgv;
  148. }
  149. - (UIView *)bottomBaseView{
  150. if (!_bottomBaseView) {
  151. _bottomBaseView = [[UIView alloc]init];
  152. _bottomBaseView.backgroundColor = UIColor.clearColor;
  153. //[_bottomBaseView addRectCorner:UIRectCornerBottomLeft|UIRectCornerBottomRight radius:adapt(21)];
  154. }
  155. return _bottomBaseView;
  156. }
  157. //- (UILabel *)incentivesNotesTitleLb{
  158. // if (!_incentivesNotesTitleLb) {
  159. // _incentivesNotesTitleLb = [[UILabel alloc]init];
  160. // _incentivesNotesTitleLb.font = LCBoldFont(16);
  161. // _incentivesNotesTitleLb.textColor = HexColorFromRGB(0x333333);
  162. // _incentivesNotesTitleLb.textAlignment = NSTextAlignmentLeft;
  163. // _incentivesNotesTitleLb.text = @"平台奖励如下:";
  164. // }
  165. // return _incentivesNotesTitleLb;
  166. //}
  167. - (UILabel *)incentivesNotesContentLb{
  168. if (!_incentivesNotesContentLb) {
  169. _incentivesNotesContentLb = [[UILabel alloc]init];
  170. _incentivesNotesContentLb.font = LCFont(13);
  171. _incentivesNotesContentLb.textColor = HexColorFromRGB(0x333333);
  172. _incentivesNotesContentLb.textAlignment = NSTextAlignmentLeft;
  173. _incentivesNotesContentLb.numberOfLines = 0;
  174. }
  175. return _incentivesNotesContentLb;
  176. }
  177. //- (UILabel *)incentivesNotesTipsLb{
  178. // if (!_incentivesNotesTipsLb) {
  179. // _incentivesNotesTipsLb = [[UILabel alloc]init];
  180. // _incentivesNotesTipsLb.font = LCFont(13);
  181. // _incentivesNotesTipsLb.textColor = HexColorFromRGB(0x333333);
  182. // _incentivesNotesTipsLb.textAlignment = NSTextAlignmentLeft;
  183. // _incentivesNotesTipsLb.text = @"提示:凡是发现自刷行为一律取消奖励资格并封号!";
  184. // }
  185. // return _incentivesNotesTipsLb;
  186. //}
  187. @end