12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- //
- // YMAboutUsInfoView.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/2/21.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMAboutUsInfoView.h"
- #import "YMAboutUsViewModel.h"
- @interface YMAboutUsInfoView ()
- /// 关于我们VM
- @property (nonatomic, strong) YMAboutUsViewModel *viewModel;
- /// App图标视图
- @property (nonatomic, strong) UIImageView *appIconView;
- /// App名称标签
- @property (nonatomic, strong) UILabel *appNameLb;
- /// App版本标签
- @property (nonatomic, strong) UILabel *appVersionLb;
- @end
- @implementation YMAboutUsInfoView
- - (void)ym_setupViews{
- [self addSubview:self.appIconView];
- [self addSubview:self.appNameLb];
- [self addSubview:self.appVersionLb];
- [self setNeedsUpdateConstraints];
- [self updateConstraintsIfNeeded];
- }
- - (void)updateConstraints{
-
- [self.appIconView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.mas_centerX);
- make.bottom.equalTo(self.mas_centerY).offset(adapt(-15));
- make.width.height.mas_equalTo(adapt(80));
- }];
-
- [self.appNameLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.appIconView.mas_centerX);
- make.top.equalTo(self.appIconView.mas_bottom).offset(adapt(15));
- }];
-
- [self.appVersionLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.appIconView.mas_centerX);
- make.top.equalTo(self.appNameLb.mas_bottom).offset(adapt(15));
- }];
-
- [super updateConstraints];
- }
- - (void)ym_bindViewModel:(YMAboutUsViewModel *)viewModel{
- if (!viewModel) {
- return;
- }
-
- _viewModel = viewModel;
-
- }
- - (UIImageView *)appIconView{
- if (!_appIconView) {
- _appIconView = [[UIImageView alloc]init];
- _appIconView.image = ImageByName(@"AppIcon");
- _appIconView.backgroundColor = UIColor.lightGrayColor;
- _appIconView.layer.cornerRadius = adapt(8);
- _appIconView.layer.masksToBounds = YES;
- }
- return _appIconView;
- }
- - (UILabel *)appNameLb{
- if (!_appNameLb) {
- _appNameLb = [[UILabel alloc]init];
- _appNameLb.font = LCBoldFont(16);
- _appNameLb.textColor = HexColorFromRGB(0x333333);
- _appNameLb.textAlignment = NSTextAlignmentCenter;
- _appNameLb.text = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];
- }
- return _appNameLb;
- }
- - (UILabel *)appVersionLb{
- if (!_appVersionLb) {
- _appVersionLb = [[UILabel alloc]init];
- _appVersionLb.font = LCFont(11);
- _appVersionLb.textColor = HexColorFromRGB(0x7E848D);
- _appVersionLb.textAlignment = NSTextAlignmentCenter;
- _appVersionLb.text = stringFormat(@"版本:v%@",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]);
- }
- return _appVersionLb;
- }
- @end
|