123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- //
- // 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) UIImageView *titleImgvL;
- /// 渐变色图片视图
- @property (nonatomic, strong) UIImageView *titleImgvR;
- /// 奖励说明内容标签
- @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.titleImgvL];
- [self.bottomBaseView addSubview:self.titleImgvR];
- [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(16));
- make.centerX.equalTo(self.bottomBaseView).offset(adapt(0));
- //make.width.mas_equalTo(adapt(156));
- make.height.mas_equalTo(adapt(22));
- }];
-
- [self.titleImgvL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.incentivesNotesTitleLb.mas_left).offset(adapt(-10));
- make.centerY.equalTo(self.incentivesNotesTitleLb);
- //make.height.mas_equalTo(adapt(22));
- }];
-
- [self.titleImgvR mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.incentivesNotesTitleLb.mas_right).offset(adapt(10));
- make.centerY.equalTo(self.incentivesNotesTitleLb);
- //make.height.mas_equalTo(adapt(22));
- }];
-
- [self.incentivesNotesContentLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.incentivesNotesTitleLb.mas_bottom).offset(adapt(7));
- make.left.equalTo(self.bottomBaseView).offset(adapt(18));
- make.right.equalTo(self.bottomBaseView).offset(adapt(-18));
- 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;
- _bgImgv.hidden = YES;
- }
- 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.whiteColor;
- _bottomBaseView.layer.cornerRadius = adapt(23);
- _bottomBaseView.layer.masksToBounds = YES;
- //[_bottomBaseView addRectCorner:UIRectCornerBottomLeft|UIRectCornerBottomRight radius:adapt(21)];
- }
- return _bottomBaseView;
- }
- - (UILabel *)incentivesNotesTitleLb{
- if (!_incentivesNotesTitleLb) {
- _incentivesNotesTitleLb = [[UILabel alloc]init];
- _incentivesNotesTitleLb.font = LCBoldFont(16);
- _incentivesNotesTitleLb.textColor = rgba(255, 63, 104, 1);
- _incentivesNotesTitleLb.textAlignment = NSTextAlignmentCenter;
- _incentivesNotesTitleLb.text = @"邀请奖励";
- }
- return _incentivesNotesTitleLb;
- }
- - (UIImageView *)titleImgvL{
- if (!_titleImgvL) {
- _titleImgvL = [[UIImageView alloc]initWithImage:ImageByName(@"ym_inviting_prizes_my_invitation_title_left")];
- }
- return _titleImgvL;
- }
- - (UIImageView *)titleImgvR{
- if (!_titleImgvR) {
- _titleImgvR = [[UIImageView alloc]initWithImage:ImageByName(@"ym_inviting_prizes_my_invitation_title_right")];
- }
- return _titleImgvR;
- }
- - (UILabel *)incentivesNotesContentLb{
- if (!_incentivesNotesContentLb) {
- _incentivesNotesContentLb = [[UILabel alloc]init];
- _incentivesNotesContentLb.font = LCFont(14);
- _incentivesNotesContentLb.textColor = rgba(102, 102, 102, 1);
- _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
|