|
@@ -0,0 +1,146 @@
|
|
|
+//
|
|
|
+// USBInsertPopView.m
|
|
|
+// 隐私保护
|
|
|
+//
|
|
|
+// Created by xd h on 2024/1/29.
|
|
|
+//
|
|
|
+
|
|
|
+#import "USBInsertPopView.h"
|
|
|
+
|
|
|
+@interface USBInsertPopView ()
|
|
|
+@property (nonatomic,strong) UIView* whiteBgView;
|
|
|
+@property (nonatomic,copy) NSString* name;
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation USBInsertPopView
|
|
|
+
|
|
|
+- (id)initWithFrame:(CGRect)frame withName:(NSString*)name{
|
|
|
+ self = [super initWithFrame:frame];
|
|
|
+ self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6];
|
|
|
+ _name = name;
|
|
|
+ [self drawAnyView];
|
|
|
+
|
|
|
+ return self;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)drawAnyView{
|
|
|
+ _whiteBgView = [UIView new];
|
|
|
+ _whiteBgView.layer.cornerRadius = 8;
|
|
|
+ _whiteBgView.backgroundColor = [UIColor whiteColor];
|
|
|
+ [self addSubview:_whiteBgView];
|
|
|
+
|
|
|
+ [_whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(390 + safeArea + 20);
|
|
|
+ make.left.mas_equalTo(0.f);
|
|
|
+ make.right.mas_equalTo(0.f);
|
|
|
+ make.bottom.mas_equalTo(20.f);
|
|
|
+ }];
|
|
|
+
|
|
|
+ NSString *titleRightStr = NSLocalizedString(@"disk_insertion_pop_title",nil);
|
|
|
+ NSString *curTitleStr = [[NSString alloc] initWithFormat:@"[%@]%@",_name,titleRightStr];
|
|
|
+ UILabel *titleLab = [[UILabel alloc] init];
|
|
|
+ titleLab.text = curTitleStr;
|
|
|
+ titleLab.textAlignment = NSTextAlignmentCenter;
|
|
|
+ titleLab.numberOfLines = 0;
|
|
|
+ titleLab.textColor = [UIColor blackColor];
|
|
|
+ titleLab.font = [UIFont boldSystemFontOfSize:18.0];
|
|
|
+ [_whiteBgView addSubview:titleLab];
|
|
|
+
|
|
|
+ [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(20);
|
|
|
+ make.right.mas_equalTo(0.f);
|
|
|
+ make.left.mas_equalTo(25.f);
|
|
|
+ make.top.mas_equalTo(20.f);
|
|
|
+ }];
|
|
|
+
|
|
|
+ NSString *curTip1Str = NSLocalizedString(@"disk_insertion_pop_tip",nil);
|
|
|
+ UILabel *tip1Lab = [[UILabel alloc] init];
|
|
|
+ tip1Lab.text = curTip1Str;
|
|
|
+ tip1Lab.numberOfLines = 0;
|
|
|
+ tip1Lab.textAlignment = NSTextAlignmentCenter;
|
|
|
+ tip1Lab.textColor = [UIColor hwColor:@"#151515" alpha:0.5];
|
|
|
+ tip1Lab.font = [UIFont systemFontOfSize:14.0];
|
|
|
+ [_whiteBgView addSubview:tip1Lab];
|
|
|
+
|
|
|
+ CGFloat curHeight = [curTip1Str boundingRectWithSize:CGSizeMake((SCREEN_W - 80), 1000) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} context:nil].size.height;
|
|
|
+
|
|
|
+ curHeight += 15;
|
|
|
+
|
|
|
+ [tip1Lab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(curHeight);
|
|
|
+ make.right.mas_equalTo(-40.f);
|
|
|
+ make.left.mas_equalTo(40.f);
|
|
|
+ make.top.mas_equalTo(titleLab.mas_bottom).offset(10.f);
|
|
|
+ }];
|
|
|
+
|
|
|
+ CGFloat imageW = SCREEN_W - 15.0*2;
|
|
|
+ CGFloat imageH = 184.0*imageW/343.0;
|
|
|
+
|
|
|
+ UIImageView *topImage = [[UIImageView alloc] init];
|
|
|
+ topImage.image = [UIImage imageNamed:@"usb_pop_image"];
|
|
|
+ [_whiteBgView addSubview:topImage];
|
|
|
+
|
|
|
+ [topImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(imageH);
|
|
|
+ make.width.mas_equalTo(imageW);
|
|
|
+ make.left.mas_equalTo(15.f);
|
|
|
+ make.top.mas_equalTo(tip1Lab.mas_bottom).offset(20);
|
|
|
+ }];
|
|
|
+
|
|
|
+ NSString *subTip1 = NSLocalizedString(@"disk_insertion_pop_tip_sub1",nil);
|
|
|
+ NSString *subTip2 = NSLocalizedString(@"disk_insertion_pop_tip_sub2",nil);
|
|
|
+ NSString *subTip3 = NSLocalizedString(@"disk_insertion_pop_tip_sub3",nil);
|
|
|
+
|
|
|
+ NSArray *titleArr = @[subTip1,subTip2,subTip3];
|
|
|
+ CGFloat labelSpace = 10.0;
|
|
|
+ CGFloat labelWidth = (imageW -20)/3.0;
|
|
|
+
|
|
|
+ for (int i=0; i<titleArr.count; i++) {
|
|
|
+
|
|
|
+ UILabel *subTipLab = [[UILabel alloc] init];
|
|
|
+ subTipLab.text = titleArr[i];
|
|
|
+ subTipLab.numberOfLines = 0;
|
|
|
+ subTipLab.textAlignment = NSTextAlignmentCenter;
|
|
|
+ subTipLab.textColor = [UIColor hwColor:@"##0A132B" alpha:1.0];
|
|
|
+ subTipLab.font = [UIFont systemFontOfSize:14.0];
|
|
|
+ [topImage addSubview:subTipLab];
|
|
|
+
|
|
|
+ [subTipLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(40);
|
|
|
+ make.width.mas_equalTo(labelWidth);
|
|
|
+ make.left.mas_equalTo(i*(labelSpace + labelWidth));
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
+ }];
|
|
|
+ }
|
|
|
+
|
|
|
+ UIButton *konwBut = [[UIButton alloc] init];
|
|
|
+ [konwBut setTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil) forState:UIControlStateNormal];
|
|
|
+ konwBut.layer.cornerRadius = 8;
|
|
|
+ konwBut.layer.masksToBounds = YES;
|
|
|
+ [konwBut addTarget:self action:@selector(colseFun) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [_whiteBgView addSubview:konwBut];
|
|
|
+
|
|
|
+ CAGradientLayer *gradientLayer = [CAGradientLayer layer];
|
|
|
+ gradientLayer.startPoint = CGPointMake(0, 0.5);
|
|
|
+ gradientLayer.endPoint = CGPointMake(0.97, 0.5);
|
|
|
+ gradientLayer.frame = CGRectMake(0, 0, imageW, 48);
|
|
|
+ gradientLayer.colors = @[(__bridge NSString *)[UIColor hwColor:@"#0CDEFD" alpha:1.0].CGColor, (__bridge NSString *)[UIColor hwColor:@"#058DFB" alpha:1.0].CGColor];
|
|
|
+ gradientLayer.locations = @[@(0), @(1.0f)];
|
|
|
+ [konwBut.layer addSublayer:gradientLayer];
|
|
|
+
|
|
|
+ [konwBut mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(48);
|
|
|
+ make.width.mas_equalTo(imageW);
|
|
|
+ make.centerX.mas_equalTo(0.f);
|
|
|
+ make.bottom.mas_equalTo(-(30 + safeArea));
|
|
|
+ }];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+- (void)colseFun
|
|
|
+{
|
|
|
+ [self removeFromSuperview];
|
|
|
+}
|
|
|
+
|
|
|
+@end
|