萤石云 iOSSDK,移植跨平台相关工程
Davin
2024-12-18 b4e1288a9b63eb820e9c9489c56aac4bf6b31067
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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