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/HDLESDetectionTypeHeaderView.m |   90 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/EZSDK/EZSDK/EZ/TempPassword/Views/HDLESDetectionTypeHeaderView.m b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLESDetectionTypeHeaderView.m
new file mode 100644
index 0000000..b577ff7
--- /dev/null
+++ b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLESDetectionTypeHeaderView.m
@@ -0,0 +1,90 @@
+//
+//  HDLESDetectionTypeHeaderView.m
+//  EZSDK
+//
+//  Created by Davin on 2024/12/17.
+//
+
+#import "HDLESDetectionTypeHeaderView.h"
+
+@interface HDLESDetectionTypeHeaderView ()
+
+@property (nonatomic, strong) UILabel *titleLabel;
+@property (nonatomic, strong) UISwitch *detectionSwitch;
+
+@property (nonatomic, copy)void(^switchBlock)(BOOL isSelected);
+
+@end
+
+@implementation HDLESDetectionTypeHeaderView
+
+- (instancetype)initWithFrame:(CGRect)frame {
+    if (self = [super initWithFrame:frame]) {
+        [self createSubviews];
+    }
+    return self;
+}
+
+- (void)createSubviews {
+    [self addSubview:self.titleLabel];
+    [self addSubview:self.detectionSwitch];
+    
+    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(self.mas_left).offset(16);
+        make.centerY.mas_equalTo(self.mas_centerY);
+    }];
+    
+    [self.detectionSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_greaterThanOrEqualTo(self.titleLabel.mas_right).offset(16);
+        make.right.mas_equalTo(self.mas_right);
+        make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
+        make.width.mas_equalTo(70);
+        make.height.mas_equalTo(28);
+    }];
+    
+    [self.detectionSwitch addTarget:self action:@selector(detectionSwitchAction:) forControlEvents:UIControlEventValueChanged];
+}
+
+#pragma mark - PublishMethod
+- (void)configSelected:(BOOL)isSelected {
+    [self.detectionSwitch setOn:isSelected];
+}
+
+/// 妫�娴嬩俊鎭缃�
+/// - Parameters:
+///   - detectionType: 妫�娴嬬被鍨�
+///   - isSelected: 鏄惁閫変腑
+- (void)configSelected:(BOOL)isSelected switchResult:(void(^)(BOOL isSelected))result {
+    self.switchBlock = result;
+    [self.detectionSwitch setOn:isSelected];
+}
+
+
+#pragma mark - PrivateMethod
+- (void)detectionSwitchAction:(UISwitch *)sender {
+    if (self.switchBlock) {
+        self.switchBlock(sender.isOn);
+    }
+}
+
+#pragma mark - Getter
+- (UILabel *)titleLabel {
+    if (!_titleLabel) {
+        _titleLabel=[[UILabel alloc] init];
+        _titleLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_14);
+        _titleLabel.textColor=HDLEZ_COLOR_TITLE_BLACK;
+        _titleLabel.text = NSLocalizedString(@"setting_action_detect", @"娲诲姩妫�娴嬫彁閱�");
+    }
+    return _titleLabel;
+}
+
+- (UISwitch *)detectionSwitch {
+    if (!_detectionSwitch) {
+        _detectionSwitch = [[UISwitch alloc] initWithFrame:CGRectZero];
+        _detectionSwitch.on = NO;
+        
+    }
+    return _detectionSwitch;
+}
+
+@end

--
Gitblit v1.8.0