// // BoxHeartbeatReStartSucView.m // 双子星云手机 // // Created by xd h on 2025/2/8. // #import "BoxHeartbeatReStartSucView.h" @implementation BoxHeartbeatReStartSucView - (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6]; [self drawAnyView]; return self; } - (void)drawAnyView{ UIView*whiteBgView = [UIView new]; whiteBgView.layer.cornerRadius = 8; whiteBgView.backgroundColor = [UIColor whiteColor]; [self addSubview:whiteBgView]; CGFloat curWhiteBgHeight = 300.f; ///获取设备当前地区的代码和APP语言环境 NSString *languageCode = [NSLocale preferredLanguages][0]; //目前支持 中文(简体 繁体) 英文 日语 if([languageCode rangeOfString:@"zh-Hans"].location != NSNotFound) { } else if([languageCode rangeOfString:@"zh-Hant"].location != NSNotFound) { } else{ curWhiteBgHeight = 500; } [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(curWhiteBgHeight); make.width.mas_equalTo(300.f); make.centerY.mas_equalTo(-40.f); make.centerX.mas_equalTo(0.f); }]; UIImageView *topImage = [[UIImageView alloc] init]; //topImage.image = [UIImage imageNamed:@"imageVersionFailTip"]; topImage.backgroundColor = [UIColor lightGrayColor]; [whiteBgView addSubview:topImage]; [topImage mas_makeConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(104.f); make.width.mas_equalTo(123.f); make.centerX.mas_equalTo(0.f); make.top.mas_equalTo(30.f); }]; NSString *curTitleStr = NSLocalizedString(@"Heartbeat_box_restart_Suc_phone",nil); UILabel *titleLab = [[UILabel alloc] init]; titleLab.text = curTitleStr; titleLab.numberOfLines = 0; titleLab.textColor = [UIColor blackColor]; titleLab.font = [UIFont boldSystemFontOfSize:18.0]; titleLab.textAlignment = NSTextAlignmentCenter; [whiteBgView addSubview:titleLab]; [titleLab mas_makeConstraints:^(MASConstraintMaker *make) { //make.height.mas_equalTo(60); make.right.mas_equalTo(-20.f); make.left.mas_equalTo(20.f); make.top.equalTo(topImage.mas_bottom).offset(20); }]; // NSString *tip1Str = NSLocalizedString(@"Heartbeat_box_restarting_phone_tip",nil); // // // NSString*allTipStr = tip1Str;//[[NSString alloc] initWithFormat:@"%@%@%@",tip1Str,tip2Str,tip3Str]; // // UILabel *tipaLab = [[UILabel alloc] init]; // tipaLab.text = allTipStr; // tipaLab.numberOfLines = 0; // tipaLab.textColor = [UIColor hwColor:@"#666666"]; // tipaLab.font = [UIFont systemFontOfSize:14.0]; // tipaLab.textAlignment = NSTextAlignmentCenter; // [whiteBgView addSubview:tipaLab]; // // [tipaLab mas_makeConstraints:^(MASConstraintMaker *make) { // //make.height.mas_equalTo(60); // make.right.mas_equalTo(-20.f); // make.left.mas_equalTo(20.f); // make.top.equalTo(titleLab.mas_bottom).offset(10); // }]; UIButton *knowBut = [[UIButton alloc] init]; [knowBut setTitle:NSLocalizedString(@"common_I_know",nil) forState:UIControlStateNormal]; //knowBut.layer.cornerRadius = 8; //knowBut.layer.masksToBounds = YES; [knowBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [knowBut addTarget:self action:@selector(colseFun) forControlEvents:UIControlEventTouchUpInside]; [whiteBgView addSubview:knowBut]; CAGradientLayer *gradientLayer = [CAGradientLayer layer]; gradientLayer.frame = CGRectMake(0, 0, 268, 40); 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)]; gradientLayer.startPoint = CGPointMake(0, 0.5); gradientLayer.endPoint = CGPointMake(0.97, 0.5); gradientLayer.cornerRadius = 8; [knowBut.layer addSublayer:gradientLayer]; // knowBut.layer.shadowColor = [UIColor hwColor:@"#058DFB"].CGColor; // // 设置阴影透明度(0.0到1.0) // knowBut.layer.shadowOpacity = 0.5; // // 设置阴影偏移量(x, y) // knowBut.layer.shadowOffset = CGSizeMake(0, 3); // // 设置阴影模糊半径 // knowBut.layer.shadowRadius = 5.0; // // 为了使阴影在按钮外部可见,需要设置masksToBounds为NO // // 注意:如果父视图设置了masksToBounds为YES,那么阴影可能仍然不可见 // knowBut.layer.masksToBounds = NO; [knowBut mas_makeConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(40.f); make.width.mas_equalTo(268.f); make.centerX.mas_equalTo(0.f); make.bottom.mas_equalTo(-30); }]; } - (void)colseFun { [self removeFromSuperview]; } @end