From a67450d72c47f400e56525125318ff1d6ca0a2e8 Mon Sep 17 00:00:00 2001 From: Davin <591807572@qq.com> Date: 星期三, 18 十二月 2024 10:39:33 +0800 Subject: [PATCH] feature 萤石活动检测&画面翻转调整 --- EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZMirrorFlipView.m | 121 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 121 insertions(+), 0 deletions(-) diff --git a/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZMirrorFlipView.m b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZMirrorFlipView.m new file mode 100644 index 0000000..d7f9a1f --- /dev/null +++ b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZMirrorFlipView.m @@ -0,0 +1,121 @@ +// +// HDLEZMirrorFlipView.m +// EZSDK +// +// Created by Davin on 2024/11/6. +// + +#import "HDLEZMirrorFlipView.h" + +@interface HDLEZMirrorFlipView () + +@property (nonatomic, strong) UIView *baseView; +@property (nonatomic, strong) UILabel *titleLabel; +@property (nonatomic, strong) UIImageView *rightIcon; +@property (nonatomic, strong) UILabel *subTitleLabel; + +@property (nonatomic, copy) void(^clickBlock)(void); + +@end + +@implementation HDLEZMirrorFlipView + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + [self createSubviews]; + } + return self; +} + +- (void)createSubviews { + self.backgroundColor = [UIColor clearColor]; + [self addSubview:self.baseView]; + [self addSubview:self.titleLabel]; + [self addSubview:self.rightIcon]; + [self addSubview:self.subTitleLabel]; + + [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.mas_top); + make.left.mas_equalTo(self.mas_left); + make.right.mas_equalTo(self.mas_right); + make.height.mas_equalTo(50.); + }]; + + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.baseView.mas_left).offset(16.); + make.centerY.mas_equalTo(self.baseView.mas_centerY); + }]; + + [self.rightIcon mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(self.mas_right).offset(-16.); + make.centerY.mas_equalTo(self.baseView.mas_centerY); + make.width.mas_equalTo(16); + make.height.mas_equalTo(16); + }]; + + [self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.baseView.mas_bottom); + make.left.mas_equalTo(self.titleLabel.mas_left); + make.height.mas_equalTo(50.); + }]; + + UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(mirrorFlipAction)]; + [self.baseView addGestureRecognizer:tapGesture]; +} + +#pragma mark - PublishMethod +/// 閰嶇疆闀滃儚缈昏浆淇℃伅 +/// - Parameters: +/// - title: 鏍囬 +/// - subTitle: 瀛愭爣棰� +/// - clickResult: 鐐瑰嚮鍥炶皟 +- (void)configTitle:(NSString *)title subTitle:(NSString *)subTitle click:(void(^)(void))clickResult { + self.titleLabel.text = title; + self.subTitleLabel.text = subTitle; + self.clickBlock = clickResult; +} + +#pragma mark - PrivateMethod +- (void)mirrorFlipAction { + if (self.clickBlock) { + self.clickBlock(); + } +} + +#pragma mark - Getter +- (UIView *)baseView { + if (!_baseView) { + _baseView = [[UIView alloc] init]; + _baseView.backgroundColor = HDLEZ_COLOR_VIEW_FOREGROUND; + } + return _baseView; +} + +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel=[[UILabel alloc] init]; + _titleLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_16); + _titleLabel.textColor=HDLEZHEXCOLOR(0x1B2D4D, 1.0);; + } + return _titleLabel; +} + +- (UIImageView *)rightIcon { + if (!_rightIcon) { + _rightIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hdl_ez_list_next"]]; + _rightIcon.contentMode = UIViewContentModeScaleAspectFill; + _rightIcon.backgroundColor = UIColor.clearColor; + } + return _rightIcon; +} + +- (UILabel *)subTitleLabel { + if (!_subTitleLabel) { + _subTitleLabel=[[UILabel alloc] init]; + _subTitleLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_14); + _subTitleLabel.textColor=HDLEZ_COLOR_TEXT_GRAY; + } + return _subTitleLabel; +} + +@end -- Gitblit v1.8.0