| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- //
- // MOGlobalView.m
- // MiMoLive
- //
- // Created by SuperC on 2025/9/8.
- //
- #import "MOGlobalView.h"
- @interface MOGlobalView ()
- @property (nonatomic, strong) UIImageView *iconImgView;
- @property (nonatomic, strong) UILabel *titleLab;
- @property (nonatomic, strong) UIButton *actionBtn;
- @end
- @implementation MOGlobalView
- - (instancetype)init {
- if (self = [super init] ) {
- [self setupUI];
- }
- return self;
- }
- - (instancetype)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
- if (self){
- [self setupUI];
- }
- return self;
- }
- - (void)setupUI{
- [self addSubview:self.iconImgView];
- [self.iconImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.height.mas_equalTo(24.0);
- make.left.equalTo(self).offset(16.0);
- make.centerY.equalTo(self);
- }];
-
- [self addSubview:self.titleLab];
- [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.iconImgView.mas_right).offset(12.0);
- make.centerY.equalTo(self);
- }];
-
- [self addSubview:self.actionBtn];
- [self.actionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self);
- }];
- }
- #pragma mark - Lazy
- - (UILabel *)titleLab{
- if(!_titleLab)
- {
- _titleLab = [UILabel new];
- _titleLab.textColor = [MOTools colorWithHexString:@"#000000" alpha:1.0];
- _titleLab.textAlignment = NSTextAlignmentLeft;
- _titleLab.font = [MOTextTools poppinsRegularFont:16.0];
- _titleLab.backgroundColor = [UIColor clearColor];
- _titleLab.text = NSLocalString(@"mimo_country_global");
- }
- return _titleLab;
- }
- - (UIButton *)actionBtn{
- if(!_actionBtn){
- _actionBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_actionBtn setTitle:@"" forState:UIControlStateNormal];
- [_actionBtn addTarget:self action:@selector(actionBtnClickAction) forControlEvents:UIControlEventTouchUpInside];
- }
- return _actionBtn;
- }
- - (void)actionBtnClickAction{
- self.viewClickBlock ? self.viewClickBlock() : nil;
- }
- - (UIImageView *)iconImgView{
- if(!_iconImgView){
- _iconImgView = [[UIImageView alloc] init];
- _iconImgView.contentMode = UIViewContentModeScaleAspectFit;
- [_iconImgView setImage:[UIImage imageNamed:@"icon_global_48"]];
- }
- return _iconImgView;
- }
- @end
|