123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- //
- // YMInvitingPrizesIncentivesNotesView.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/3/6.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMInvitingPrizesIncentivesNotesView.h"
- #import "YMInvitingPrizesViewModel.h"
- @interface YMInvitingPrizesIncentivesNotesView ()
- /// 邀请有奖VM
- @property (nonatomic, strong) YMInvitingPrizesViewModel *viewModel;
- /// 顶部右视图
- //@property (nonatomic, strong) UIView *topRightView;
- @property (nonatomic, strong) UIImageView *bgImgv;
- @property (nonatomic, strong) UIImageView *titleImgv;
- ///// 渐变色图片视图
- //@property (nonatomic, strong) UIImageView *gradientImageView;
- ///// 功能标题标签
- //@property (nonatomic, strong) UILabel *functionTitleLb;
- /// 底部基础视图
- @property (nonatomic, strong) UIView *bottomBaseView;
- /// 奖励说明标题标签
- //@property (nonatomic, strong) UILabel *incentivesNotesTitleLb;
- /// 奖励说明内容标签
- @property (nonatomic, strong) UILabel *incentivesNotesContentLb;
- ///// 奖励说明提示标签
- //@property (nonatomic, strong) UILabel *incentivesNotesTipsLb;
- @end
- @implementation YMInvitingPrizesIncentivesNotesView
- - (void)ym_setupViews{
- // [self addSubview:self.topRightView];
- // [self.topRightView addSubview:self.gradientImageView];
- // [self.topRightView addSubview:self.functionTitleLb];
-
-
-
- [self addSubview:self.bottomBaseView];
- [self.bottomBaseView addSubview:self.bgImgv];
- [self.bottomBaseView addSubview:self.titleImgv];
- // [self.bottomBaseView addSubview:self.incentivesNotesTitleLb];
- [self.bottomBaseView addSubview:self.incentivesNotesContentLb];
- // [self.bottomBaseView addSubview:self.incentivesNotesTipsLb];
- [self setNeedsUpdateConstraints];
- [self updateConstraintsIfNeeded];
- }
- - (void)updateConstraints{
-
- // [self.topRightView mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self);
- // make.left.equalTo(self).offset(adapt(15));
- // make.right.equalTo(self).offset(adapt(-15));
- // make.height.mas_equalTo(adapt(45));
- // }];
- //
- // [self.gradientImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.bottom.equalTo(self.topRightView.mas_bottom).offset(adapt(-5));
- // make.left.equalTo(self.topRightView).offset(adapt(15));
- // make.width.mas_equalTo(adapt(90));
- // make.height.mas_equalTo(adapt(15));
- // }];
- //
- // [self.functionTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.centerY.equalTo(self.topRightView.mas_centerY);
- // make.left.equalTo(self.topRightView).offset(adapt(18));
- // }];
-
-
-
- [self.bottomBaseView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self).offset(adapt(0));
- make.left.equalTo(self).offset(adapt(15));
- make.right.equalTo(self).offset(adapt(-15));
- make.bottom.equalTo(self);
- }];
-
- [self.bgImgv mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.bottomBaseView);
- }];
-
- [self.titleImgv mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.bottomBaseView).offset(adapt(28));
- make.centerX.equalTo(self.bottomBaseView);
- make.width.mas_equalTo(adapt(156));
- make.height.mas_equalTo(adapt(25));
- }];
-
- // [self.incentivesNotesTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.bottomBaseView).offset(adapt(31));
- // make.left.equalTo(self.bottomBaseView).offset(adapt(12));
- // }];
-
- [self.incentivesNotesContentLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.titleImgv.mas_bottom).offset(adapt(16));
- make.left.equalTo(self.bottomBaseView).offset(adapt(15));
- make.right.equalTo(self.bottomBaseView).offset(adapt(-15));
- make.bottom.equalTo(self.bottomBaseView).offset(adapt(-31));
- }];
-
- // [self.incentivesNotesTipsLb mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.incentivesNotesContentLb.mas_bottom).offset(adapt(10));
- // make.left.equalTo(self.bottomBaseView).offset(adapt(12));
- // make.right.equalTo(self.bottomBaseView).offset(adapt(-12));
- // make.bottom.equalTo(self.bottomBaseView).offset(adapt(-31));
- // }];
- [super updateConstraints];
- }
- - (void)ym_bindViewModel:(YMInvitingPrizesViewModel *)viewModel{
- if (!viewModel) {
- return;
- }
-
- _viewModel = viewModel;
-
- RAC(self.incentivesNotesContentLb, attributedText) = RACObserve(self.viewModel, incentivesNotes);
-
- }
- //- (UIView *)topRightView{
- // if (!_topRightView) {
- // _topRightView = [[UIView alloc]init];
- // _topRightView.backgroundColor = UIColor.clearColor;
- // //[_topRightView addRectCorner:UIRectCornerTopLeft|UIRectCornerTopRight radius:adapt(21)];
- // }
- // return _topRightView;
- //}
- //
- //
- //- (UIImageView *)gradientImageView{
- // if (!_gradientImageView) {
- // _gradientImageView = [[UIImageView alloc]init];
- // _gradientImageView.image = ImageByName(@"ym_inviting_prizes_line_icon");
- // }
- // return _gradientImageView;
- //}
- //
- //- (UILabel *)functionTitleLb{
- // if (!_functionTitleLb) {
- // _functionTitleLb = [[UILabel alloc]init];
- // _functionTitleLb.font = LCBoldFont(18);
- // _functionTitleLb.textColor = HexColorFromRGB(0x333333);
- // _functionTitleLb.textAlignment = NSTextAlignmentLeft;
- // _functionTitleLb.text = @"邀请奖励";
- // }
- // return _functionTitleLb;
- //}
- - (UIImageView *)bgImgv {
- if (!_bgImgv) {
- _bgImgv = [[UIImageView alloc] init];
- UIImage *image = ImageByName(@"ym_inviting_prizes_invitation_reward_bg");
- UIEdgeInsets insets = UIEdgeInsetsMake(40, 0, 40, 0); // 上、左、下、右的拉伸边距
- // 创建可拉伸的图像
- UIImage *stretchableImage = [image resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];
- _bgImgv.image = stretchableImage;
- }
- return _bgImgv;
- }
- - (UIImageView *)titleImgv {
- if (!_titleImgv) {
- _titleImgv = [[UIImageView alloc] init];
- _titleImgv.image = ImageByName(@"ym_inviting_prizes_invitation_reward_title");
- }
- return _titleImgv;
- }
- - (UIView *)bottomBaseView{
- if (!_bottomBaseView) {
- _bottomBaseView = [[UIView alloc]init];
- _bottomBaseView.backgroundColor = UIColor.clearColor;
- //[_bottomBaseView addRectCorner:UIRectCornerBottomLeft|UIRectCornerBottomRight radius:adapt(21)];
- }
- return _bottomBaseView;
- }
- //- (UILabel *)incentivesNotesTitleLb{
- // if (!_incentivesNotesTitleLb) {
- // _incentivesNotesTitleLb = [[UILabel alloc]init];
- // _incentivesNotesTitleLb.font = LCBoldFont(16);
- // _incentivesNotesTitleLb.textColor = HexColorFromRGB(0x333333);
- // _incentivesNotesTitleLb.textAlignment = NSTextAlignmentLeft;
- // _incentivesNotesTitleLb.text = @"平台奖励如下:";
- // }
- // return _incentivesNotesTitleLb;
- //}
- - (UILabel *)incentivesNotesContentLb{
- if (!_incentivesNotesContentLb) {
- _incentivesNotesContentLb = [[UILabel alloc]init];
- _incentivesNotesContentLb.font = LCFont(13);
- _incentivesNotesContentLb.textColor = HexColorFromRGB(0x333333);
- _incentivesNotesContentLb.textAlignment = NSTextAlignmentLeft;
- _incentivesNotesContentLb.numberOfLines = 0;
- }
- return _incentivesNotesContentLb;
- }
- //- (UILabel *)incentivesNotesTipsLb{
- // if (!_incentivesNotesTipsLb) {
- // _incentivesNotesTipsLb = [[UILabel alloc]init];
- // _incentivesNotesTipsLb.font = LCFont(13);
- // _incentivesNotesTipsLb.textColor = HexColorFromRGB(0x333333);
- // _incentivesNotesTipsLb.textAlignment = NSTextAlignmentLeft;
- // _incentivesNotesTipsLb.text = @"提示:凡是发现自刷行为一律取消奖励资格并封号!";
- // }
- // return _incentivesNotesTipsLb;
- //}
- @end
|