BoxHeartbeatReStartSucView.m 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. //
  2. // BoxHeartbeatReStartSucView.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2025/2/8.
  6. //
  7. #import "BoxHeartbeatReStartSucView.h"
  8. @implementation BoxHeartbeatReStartSucView
  9. //- (id)initWithFrame:(CGRect)frame{
  10. // self = [super initWithFrame:frame];
  11. // self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6];
  12. // [self drawAnyView];
  13. //
  14. // return self;
  15. //}
  16. - (id)initWithType:(NSInteger)type
  17. {
  18. self = [super init];
  19. self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6];
  20. self.type = type;
  21. [self drawAnyView];
  22. return self;
  23. }
  24. - (void)drawAnyView{
  25. UIView*whiteBgView = [UIView new];
  26. whiteBgView.layer.cornerRadius = 8;
  27. whiteBgView.backgroundColor = [UIColor whiteColor];
  28. [self addSubview:whiteBgView];
  29. CGFloat curWhiteBgHeight = 300.f;
  30. ///获取设备当前地区的代码和APP语言环境
  31. NSString *languageCode = [NSLocale preferredLanguages][0];
  32. //目前支持 中文(简体 繁体) 英文 日语
  33. if([languageCode rangeOfString:@"zh-Hans"].location != NSNotFound)
  34. {
  35. }
  36. else if([languageCode rangeOfString:@"zh-Hant"].location != NSNotFound)
  37. {
  38. }
  39. else{
  40. curWhiteBgHeight = 500;
  41. }
  42. [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.height.mas_equalTo(curWhiteBgHeight);
  44. make.width.mas_equalTo(300.f);
  45. make.centerY.mas_equalTo(-40.f);
  46. make.centerX.mas_equalTo(0.f);
  47. }];
  48. UIImageView *topImage = [[UIImageView alloc] init];
  49. topImage.image = [UIImage imageNamed:@"imageVersionDoneTip"];
  50. //topImage.backgroundColor = [UIColor lightGrayColor];
  51. [whiteBgView addSubview:topImage];
  52. [topImage mas_makeConstraints:^(MASConstraintMaker *make) {
  53. make.height.mas_equalTo(104.f);
  54. make.width.mas_equalTo(123.f);
  55. make.centerX.mas_equalTo(0.f);
  56. make.top.mas_equalTo(30.f);
  57. }];
  58. NSString *curTitleStr = NSLocalizedString(@"Heartbeat_box_restart_Suc_phone",nil);
  59. if(_type == 2){
  60. curTitleStr = NSLocalizedString(@"Heartbeat_box_restart_Suc_Box",nil);
  61. }
  62. UILabel *titleLab = [[UILabel alloc] init];
  63. titleLab.text = curTitleStr;
  64. titleLab.numberOfLines = 0;
  65. titleLab.textColor = [UIColor blackColor];
  66. titleLab.font = [UIFont boldSystemFontOfSize:18.0];
  67. titleLab.textAlignment = NSTextAlignmentCenter;
  68. [whiteBgView addSubview:titleLab];
  69. [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
  70. //make.height.mas_equalTo(60);
  71. make.right.mas_equalTo(-20.f);
  72. make.left.mas_equalTo(20.f);
  73. make.top.equalTo(topImage.mas_bottom).offset(20);
  74. }];
  75. // NSString *tip1Str = NSLocalizedString(@"Heartbeat_box_restarting_phone_tip",nil);
  76. //
  77. //
  78. // NSString*allTipStr = tip1Str;//[[NSString alloc] initWithFormat:@"%@%@%@",tip1Str,tip2Str,tip3Str];
  79. //
  80. // UILabel *tipaLab = [[UILabel alloc] init];
  81. // tipaLab.text = allTipStr;
  82. // tipaLab.numberOfLines = 0;
  83. // tipaLab.textColor = [UIColor hwColor:@"#666666"];
  84. // tipaLab.font = [UIFont systemFontOfSize:14.0];
  85. // tipaLab.textAlignment = NSTextAlignmentCenter;
  86. // [whiteBgView addSubview:tipaLab];
  87. //
  88. // [tipaLab mas_makeConstraints:^(MASConstraintMaker *make) {
  89. // //make.height.mas_equalTo(60);
  90. // make.right.mas_equalTo(-20.f);
  91. // make.left.mas_equalTo(20.f);
  92. // make.top.equalTo(titleLab.mas_bottom).offset(10);
  93. // }];
  94. UIButton *knowBut = [[UIButton alloc] init];
  95. [knowBut setTitle:NSLocalizedString(@"common_I_know",nil) forState:UIControlStateNormal];
  96. //knowBut.layer.cornerRadius = 8;
  97. //knowBut.layer.masksToBounds = YES;
  98. [knowBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  99. [knowBut addTarget:self action:@selector(colseFun) forControlEvents:UIControlEventTouchUpInside];
  100. [whiteBgView addSubview:knowBut];
  101. CAGradientLayer *gradientLayer = [CAGradientLayer layer];
  102. gradientLayer.frame = CGRectMake(0, 0, 268, 40);
  103. gradientLayer.colors = @[(__bridge NSString *)[UIColor hwColor:@"#0CDEFD" alpha:1.0].CGColor, (__bridge NSString *)[UIColor hwColor:@"#058DFB" alpha:1.0].CGColor];
  104. gradientLayer.locations = @[@(0), @(1.0f)];
  105. gradientLayer.startPoint = CGPointMake(0, 0.5);
  106. gradientLayer.endPoint = CGPointMake(0.97, 0.5);
  107. gradientLayer.cornerRadius = 8;
  108. [knowBut.layer addSublayer:gradientLayer];
  109. // knowBut.layer.shadowColor = [UIColor hwColor:@"#058DFB"].CGColor;
  110. // // 设置阴影透明度(0.0到1.0)
  111. // knowBut.layer.shadowOpacity = 0.5;
  112. // // 设置阴影偏移量(x, y)
  113. // knowBut.layer.shadowOffset = CGSizeMake(0, 3);
  114. // // 设置阴影模糊半径
  115. // knowBut.layer.shadowRadius = 5.0;
  116. // // 为了使阴影在按钮外部可见,需要设置masksToBounds为NO
  117. // // 注意:如果父视图设置了masksToBounds为YES,那么阴影可能仍然不可见
  118. // knowBut.layer.masksToBounds = NO;
  119. [knowBut mas_makeConstraints:^(MASConstraintMaker *make) {
  120. make.height.mas_equalTo(40.f);
  121. make.width.mas_equalTo(268.f);
  122. make.centerX.mas_equalTo(0.f);
  123. make.bottom.mas_equalTo(-30);
  124. }];
  125. }
  126. - (void)colseFun
  127. {
  128. [self removeFromSuperview];
  129. }
  130. @end