// // USBInsertPopView.m // 隐私保护 // // Created by xd h on 2024/1/29. // #import "USBInsertPopView.h" #import @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(500 + 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); }]; LOTAnimationView *animation = [LOTAnimationView animationNamed:@"usbInsertAnimation"]; animation.loopAnimation = YES; //animation.contentMode = UIViewContentModeScaleAspectFill; [_whiteBgView addSubview:animation]; [animation playWithCompletion:^(BOOL animationFinished) { // Do Something }]; CGFloat animationImageW = SCREEN_W - 15.0*2; CGFloat animationImageH = 232.0*animationImageW/343.0; [animation mas_makeConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(animationImageH); make.width.mas_equalTo(animationImageW); make.left.mas_equalTo(15.f); make.top.mas_equalTo(tip1Lab.mas_bottom).offset(0); }]; 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