imageVersionUpdateFailView.m 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. //
  2. // imageVersionUpdateFailView.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/12/31.
  6. //
  7. #import "imageVersionUpdateFailView.h"
  8. @implementation imageVersionUpdateFailView
  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. [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  21. make.height.mas_equalTo(343.f);
  22. make.width.mas_equalTo(300.f);
  23. make.centerY.mas_equalTo(-40.f);
  24. make.centerX.mas_equalTo(0.f);
  25. }];
  26. UIImageView *topImage = [[UIImageView alloc] init];
  27. topImage.image = [UIImage imageNamed:@"imageVersionFailTip"];
  28. [whiteBgView addSubview:topImage];
  29. [topImage mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.height.mas_equalTo(104.f);
  31. make.width.mas_equalTo(123.f);
  32. make.centerX.mas_equalTo(0.f);
  33. make.top.mas_equalTo(30.f);
  34. }];
  35. NSString *curTitleStr = NSLocalizedString(@"image_version_update_fail_title",nil);
  36. UILabel *titleLab = [[UILabel alloc] init];
  37. titleLab.text = curTitleStr;
  38. titleLab.numberOfLines = 0;
  39. titleLab.textColor = [UIColor blackColor];
  40. titleLab.font = [UIFont boldSystemFontOfSize:18.0];
  41. titleLab.textAlignment = NSTextAlignmentCenter;
  42. [whiteBgView addSubview:titleLab];
  43. [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
  44. //make.height.mas_equalTo(60);
  45. make.right.mas_equalTo(-20.f);
  46. make.left.mas_equalTo(20.f);
  47. make.top.equalTo(topImage.mas_bottom).offset(20);
  48. }];
  49. NSString *tip1Str = NSLocalizedString(@"image_version_update_fail_tip1",nil);
  50. UILabel *tipaLab = [[UILabel alloc] init];
  51. tipaLab.text = tip1Str;
  52. tipaLab.numberOfLines = 0;
  53. tipaLab.textColor = [UIColor hwColor:@"#666666"];
  54. tipaLab.font = [UIFont systemFontOfSize:14.0];
  55. tipaLab.textAlignment = NSTextAlignmentCenter;
  56. [whiteBgView addSubview:tipaLab];
  57. [tipaLab 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(titleLab.mas_bottom).offset(10);
  62. }];
  63. NSString *tip2Str = [[NSString alloc] initWithFormat:@"SN:%@",ksharedAppDelegate.DeviceThirdIdMod.data.changeSn];
  64. UILabel *tip2Lab = [[UILabel alloc] init];
  65. tip2Lab.text = tip2Str;
  66. tip2Lab.numberOfLines = 0;
  67. tip2Lab.textColor = [UIColor hwColor:@"#666666"];
  68. tip2Lab.font = [UIFont systemFontOfSize:14.0];
  69. tip2Lab.textAlignment = NSTextAlignmentCenter;
  70. [whiteBgView addSubview:tip2Lab];
  71. [tip2Lab mas_makeConstraints:^(MASConstraintMaker *make) {
  72. //make.height.mas_equalTo(60);
  73. make.right.mas_equalTo(-20.f);
  74. make.left.mas_equalTo(20.f);
  75. make.top.equalTo(tipaLab.mas_bottom).offset(5);
  76. }];
  77. UIButton *knowBut = [[UIButton alloc] init];
  78. [knowBut setTitle:NSLocalizedString(@"common_I_know",nil) forState:UIControlStateNormal];
  79. //knowBut.layer.cornerRadius = 8;
  80. //knowBut.layer.masksToBounds = YES;
  81. [knowBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  82. [knowBut addTarget:self action:@selector(colseFun) forControlEvents:UIControlEventTouchUpInside];
  83. [whiteBgView addSubview:knowBut];
  84. CAGradientLayer *gradientLayer = [CAGradientLayer layer];
  85. gradientLayer.frame = CGRectMake(0, 0, 268, 40);
  86. gradientLayer.colors = @[(__bridge NSString *)[UIColor hwColor:@"#0CDEFD" alpha:1.0].CGColor, (__bridge NSString *)[UIColor hwColor:@"#058DFB" alpha:1.0].CGColor];
  87. gradientLayer.locations = @[@(0), @(1.0f)];
  88. gradientLayer.startPoint = CGPointMake(0, 0.5);
  89. gradientLayer.endPoint = CGPointMake(0.97, 0.5);
  90. gradientLayer.cornerRadius = 8;
  91. [knowBut.layer addSublayer:gradientLayer];
  92. // knowBut.layer.shadowColor = [UIColor hwColor:@"#058DFB"].CGColor;
  93. // // 设置阴影透明度(0.0到1.0)
  94. // knowBut.layer.shadowOpacity = 0.5;
  95. // // 设置阴影偏移量(x, y)
  96. // knowBut.layer.shadowOffset = CGSizeMake(0, 3);
  97. // // 设置阴影模糊半径
  98. // knowBut.layer.shadowRadius = 5.0;
  99. // // 为了使阴影在按钮外部可见,需要设置masksToBounds为NO
  100. // // 注意:如果父视图设置了masksToBounds为YES,那么阴影可能仍然不可见
  101. // knowBut.layer.masksToBounds = NO;
  102. [knowBut mas_makeConstraints:^(MASConstraintMaker *make) {
  103. make.height.mas_equalTo(40.f);
  104. make.width.mas_equalTo(268.f);
  105. make.centerX.mas_equalTo(0.f);
  106. make.bottom.mas_equalTo(-30);
  107. }];
  108. }
  109. - (void)colseFun
  110. {
  111. [self removeFromSuperview];
  112. if(_didClickUpdateDoneFun){
  113. _didClickUpdateDoneFun();
  114. }
  115. }
  116. @end