BoxHeartbeatReStartSucView.m 4.9 KB

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