imageVersionUpdateDoneView.m 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. //
  2. // imageVersionUpdateDoneView.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/12/27.
  6. //
  7. #import "imageVersionUpdateDoneView.h"
  8. @implementation imageVersionUpdateDoneView
  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(289.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:@"imageVersionDoneTip"];
  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_suc_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(0.f);
  46. make.left.mas_equalTo(0.f);
  47. make.top.equalTo(topImage.mas_bottom).offset(20);
  48. }];
  49. UIButton *knowBut = [[UIButton alloc] init];
  50. [knowBut setTitle:NSLocalizedString(@"common_I_know",nil) forState:UIControlStateNormal];
  51. //knowBut.layer.cornerRadius = 8;
  52. //knowBut.layer.masksToBounds = YES;
  53. [knowBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  54. [knowBut addTarget:self action:@selector(colseFun) forControlEvents:UIControlEventTouchUpInside];
  55. [whiteBgView addSubview:knowBut];
  56. CAGradientLayer *gradientLayer = [CAGradientLayer layer];
  57. gradientLayer.frame = CGRectMake(0, 0, 268, 40);
  58. gradientLayer.colors = @[(__bridge NSString *)[UIColor hwColor:@"#0CDEFD" alpha:1.0].CGColor, (__bridge NSString *)[UIColor hwColor:@"#058DFB" alpha:1.0].CGColor];
  59. gradientLayer.locations = @[@(0), @(1.0f)];
  60. gradientLayer.startPoint = CGPointMake(0, 0.5);
  61. gradientLayer.endPoint = CGPointMake(0.97, 0.5);
  62. gradientLayer.cornerRadius = 8;
  63. [knowBut.layer addSublayer:gradientLayer];
  64. // knowBut.layer.shadowColor = [UIColor hwColor:@"#058DFB"].CGColor;
  65. // // 设置阴影透明度(0.0到1.0)
  66. // knowBut.layer.shadowOpacity = 0.5;
  67. // // 设置阴影偏移量(x, y)
  68. // knowBut.layer.shadowOffset = CGSizeMake(0, 3);
  69. // // 设置阴影模糊半径
  70. // knowBut.layer.shadowRadius = 5.0;
  71. // // 为了使阴影在按钮外部可见,需要设置masksToBounds为NO
  72. // // 注意:如果父视图设置了masksToBounds为YES,那么阴影可能仍然不可见
  73. // knowBut.layer.masksToBounds = NO;
  74. [knowBut mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.height.mas_equalTo(40.f);
  76. make.width.mas_equalTo(268.f);
  77. make.centerX.mas_equalTo(0.f);
  78. make.bottom.mas_equalTo(-30);
  79. }];
  80. }
  81. - (void)colseFun
  82. {
  83. [self removeFromSuperview];
  84. if(_didClickUpdateDoneFun){
  85. _didClickUpdateDoneFun();
  86. }
  87. }
  88. @end