杨锴
2024-08-14 909e20941e45f8712c012db602034b47da0bfdb0
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
//
//  TZAuthLimitedFooterTipView.m
//  TZImagePickerController
//
//  Created by qiaoxy on 2021/8/24.
//
 
#import "TZAuthLimitedFooterTipView.h"
#import "TZImagePickerController.h"
 
@interface TZAuthLimitedFooterTipView()
@property (nonatomic,strong) UIImageView *tipImgView;
@property (nonatomic,strong) UILabel *tipLable;
@property (nonatomic,strong) UIImageView *detailImgView;
@end
 
@implementation TZAuthLimitedFooterTipView
 
- (instancetype)init {
    self = [super init];
    if (self) {
        [self initSubViews];
    }
    return self;
}
 
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self initSubViews];
    }
    return self;
}
 
- (void)initSubViews {
    [self addSubview:self.tipImgView];
    [self addSubview:self.tipLable];
    [self addSubview:self.detailImgView];
    CGFloat margin = 15;
    CGFloat tipImgViewWH = 20;
    CGFloat detailImgViewWH = 12;
    CGFloat screenW = [UIScreen mainScreen].bounds.size.width;
 
    self.tipImgView.frame = CGRectMake(margin, 0, tipImgViewWH, tipImgViewWH);
    self.detailImgView.frame = CGRectMake(screenW - margin - detailImgViewWH, 0, detailImgViewWH, detailImgViewWH);
    
    CGFloat tipLabelX = CGRectGetMaxX(self.tipImgView.frame) + 10;
    CGFloat tipLabelW = screenW - tipLabelX - detailImgViewWH - margin - 4;
    self.tipLable.frame = CGRectMake(tipLabelX, 0, tipLabelW, self.bounds.size.height);
    
    self.tipImgView.center = CGPointMake(self.tipImgView.center.x, self.tipLable.center.y);
    self.detailImgView.center = CGPointMake(self.detailImgView.center.x, self.tipLable.center.y);
}
 
#pragma mark - Getter
 
- (UIImageView *)tipImgView {
    if (!_tipImgView) {
        _tipImgView = [[UIImageView alloc] init];
        _tipImgView.contentMode = UIViewContentModeScaleAspectFit;
        _tipImgView.image = [UIImage tz_imageNamedFromMyBundle:@"tip"];
    }
    return _tipImgView;
}
 
- (UILabel *)tipLable {
    if (!_tipLable) {
        _tipLable = [[UILabel alloc] init];
        NSString *appName = [TZCommonTools tz_getAppName];
        _tipLable.text = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Allow %@ to access your all photos"], appName];
        _tipLable.numberOfLines = 0;
        _tipLable.font = [UIFont systemFontOfSize:14];
        _tipLable.textColor = [UIColor colorWithRed:0.40 green:0.40 blue:0.40 alpha:1.0];
    }
    return _tipLable;
}
 
- (UIImageView *)detailImgView {
    if (!_detailImgView) {
        _detailImgView = [[UIImageView alloc] init];
        _detailImgView.contentMode = UIViewContentModeScaleAspectFit;
        _detailImgView.image = [UIImage tz_imageNamedFromMyBundle:@"right_arrow"];
    }
    return _detailImgView;
}
 
@end