// // YMAdolescentModelTipsView.m // MSYOUPAI // // Created by YoMi on 2024/2/22. // Copyright © 2024 MS. All rights reserved. // #import "YMAdolescentModelTipsView.h" #import "YMAdolescentModelViewModel.h" @interface YMAdolescentModelTipsView () /// 青少年模式VM @property (nonatomic, strong) YMAdolescentModelViewModel *viewModel; /// 青少年模式提示图片视图 @property (nonatomic, strong) UIImageView *adolescentModelImageView; /// 青少年模式状态标签 @property (nonatomic, strong) UILabel *adolescentModelStatusLb; /// 青少年模式提示标签 @property (nonatomic, strong) UILabel *adolescentModelTipsLb; @end @implementation YMAdolescentModelTipsView - (void)ym_setupViews{ [self addSubview:self.adolescentModelImageView]; [self addSubview:self.adolescentModelStatusLb]; [self addSubview:self.adolescentModelTipsLb]; [self setNeedsUpdateConstraints]; [self updateConstraintsIfNeeded]; } - (void)updateConstraints{ [self.adolescentModelImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.mas_centerX); make.top.equalTo(self).offset(adapt(30)); make.width.mas_equalTo(adapt(230)); make.height.mas_equalTo(adapt(230)); }]; [self.adolescentModelStatusLb mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.adolescentModelImageView.mas_bottom).offset(adapt(15)); make.left.equalTo(self).offset(adapt(15)); make.right.equalTo(self).offset(adapt(-15)); }]; [self.adolescentModelTipsLb mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.adolescentModelStatusLb.mas_bottom).offset(adapt(15)); make.left.equalTo(self).offset(adapt(15)); make.right.equalTo(self).offset(adapt(-15)); make.bottom.equalTo(self).offset(adapt(-30)).priorityHigh(); }]; [super updateConstraints]; } - (void)ym_bindViewModel:(YMAdolescentModelViewModel *)viewModel{ if (!viewModel) { return; } _viewModel = viewModel; } - (UIImageView *)adolescentModelImageView{ if (!_adolescentModelImageView) { _adolescentModelImageView = [[UIImageView alloc]init]; _adolescentModelImageView.image = ImageByName(@"ym_common_adolescent_model_tips_two_icon"); } return _adolescentModelImageView; } - (UILabel *)adolescentModelStatusLb{ if (!_adolescentModelStatusLb) { _adolescentModelStatusLb = [[UILabel alloc]init]; _adolescentModelStatusLb.font = LCFont(15); _adolescentModelStatusLb.textColor = HexColorFromRGB(0x333333); _adolescentModelStatusLb.textAlignment = NSTextAlignmentCenter; _adolescentModelStatusLb.text = @"未成年模式已关闭"; } return _adolescentModelStatusLb; } - (UILabel *)adolescentModelTipsLb{ if (!_adolescentModelTipsLb) { _adolescentModelTipsLb = [[UILabel alloc]init]; _adolescentModelTipsLb.font = LCFont(12); _adolescentModelTipsLb.textColor = HexColorFromRGB(0x9c9c9c); _adolescentModelTipsLb.textAlignment = NSTextAlignmentCenter; _adolescentModelTipsLb.text = @"开启未成年模式,防止未成年使用"; } return _adolescentModelTipsLb; } @end