imageVersionRenewTipView.m 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. //
  2. // imageVersionRenewTipView.m
  3. // 隐私保护
  4. //
  5. // Created by xd h on 2023/12/21.
  6. //
  7. #import "imageVersionRenewTipView.h"
  8. @interface imageVersionRenewTipView ()
  9. @property (nonatomic,strong) UIView* whiteBgView;
  10. @end
  11. @implementation imageVersionRenewTipView
  12. - (id)initWithFrame:(CGRect)frame{
  13. self = [super initWithFrame:frame];
  14. self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6];
  15. [self drawAnyView];
  16. return self;
  17. }
  18. - (void)drawAnyView{
  19. _whiteBgView = [UIView new];
  20. _whiteBgView.layer.cornerRadius = 8;
  21. _whiteBgView.backgroundColor = [UIColor whiteColor];
  22. [self addSubview:_whiteBgView];
  23. [_whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.height.mas_equalTo(332);
  25. make.width.mas_equalTo(300.f);
  26. make.centerY.mas_equalTo(-50.f);
  27. make.centerX.mas_equalTo(0.f);
  28. }];
  29. UIImageView *topImage = [[UIImageView alloc] init];
  30. topImage.image = [UIImage imageNamed:@"imageVersionTipBg"];
  31. [_whiteBgView addSubview:topImage];
  32. [topImage mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.height.mas_equalTo(160);
  34. make.width.mas_equalTo(300.f);
  35. make.left.mas_equalTo(0.f);
  36. make.top.mas_equalTo(-40.f);
  37. }];
  38. NSString *curTitleStr = NSLocalizedString(@"image_version_pop_title",nil);
  39. UILabel *titleLab = [[UILabel alloc] init];
  40. titleLab.text = curTitleStr;
  41. titleLab.numberOfLines = 0;
  42. titleLab.textColor = [UIColor whiteColor];
  43. titleLab.font = [UIFont boldSystemFontOfSize:22.0];
  44. [topImage addSubview:titleLab];
  45. [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.height.mas_equalTo(60);
  47. make.right.mas_equalTo(0.f);
  48. make.left.mas_equalTo(25.f);
  49. make.top.mas_equalTo(55.f);
  50. }];
  51. NSString *curTip1Str = NSLocalizedString(@"image_version_pop_tip1",nil);
  52. UILabel *tip1Lab = [[UILabel alloc] init];
  53. tip1Lab.text = curTip1Str;
  54. tip1Lab.numberOfLines = 0;
  55. tip1Lab.textAlignment = NSTextAlignmentCenter;
  56. tip1Lab.textColor = [UIColor hwColor:@"#151515" alpha:1.0];
  57. tip1Lab.font = [UIFont systemFontOfSize:16.0];
  58. [_whiteBgView addSubview:tip1Lab];
  59. CGFloat curHeight = [curTip1Str boundingRectWithSize:CGSizeMake(280, 1000) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16.0]} context:nil].size.height;
  60. curHeight += 15;
  61. [tip1Lab mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.height.mas_equalTo(curHeight);
  63. make.right.mas_equalTo(-10.f);
  64. make.left.mas_equalTo(10.f);
  65. make.top.mas_equalTo(topImage.mas_bottom).offset(20.f);
  66. }];
  67. NSString *curTip2Str = NSLocalizedString(@"image_version_pop_tip2",nil);
  68. CGFloat curHeight2 = [curTip2Str boundingRectWithSize:CGSizeMake(280, 1000) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16.0]} context:nil].size.height;
  69. curHeight2 += 5;
  70. UILabel *tip2Lab = [[UILabel alloc] init];
  71. tip2Lab.text = curTip2Str;
  72. tip2Lab.numberOfLines = 0;
  73. tip2Lab.textAlignment = NSTextAlignmentCenter;
  74. tip2Lab.textColor = [UIColor hwColor:@"#151515" alpha:0.5];
  75. tip2Lab.font = [UIFont systemFontOfSize:14.0];
  76. [_whiteBgView addSubview:tip2Lab];
  77. //tip2Lab.backgroundColor = [UIColor greenColor];
  78. [tip2Lab mas_makeConstraints:^(MASConstraintMaker *make) {
  79. make.height.mas_equalTo(curHeight2);
  80. make.right.mas_equalTo(-10.f);
  81. make.left.mas_equalTo(10.f);
  82. make.top.mas_equalTo(tip1Lab.mas_bottom).offset(10.f);
  83. }];
  84. [_whiteBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
  85. make.height.mas_equalTo(240 + curHeight + curHeight2);
  86. make.width.mas_equalTo(300.f);
  87. make.centerY.mas_equalTo(-50.f);
  88. make.centerX.mas_equalTo(0.f);
  89. }];
  90. UIButton *konwBut = [[UIButton alloc] init];
  91. [konwBut setTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil) forState:UIControlStateNormal];
  92. konwBut.layer.cornerRadius = 8;
  93. konwBut.layer.masksToBounds = YES;
  94. [konwBut addTarget:self action:@selector(colseFun) forControlEvents:UIControlEventTouchUpInside];
  95. [_whiteBgView addSubview:konwBut];
  96. CAGradientLayer *gradientLayer = [CAGradientLayer layer];
  97. gradientLayer.frame = CGRectMake(0, 0, 160, 48);
  98. gradientLayer.colors = @[(__bridge NSString *)[UIColor hwColor:@"#0CDEFD" alpha:1.0].CGColor, (__bridge NSString *)[UIColor hwColor:@"#058DFB" alpha:1.0].CGColor];
  99. gradientLayer.locations = @[@(0), @(1.0f)];
  100. [konwBut.layer addSublayer:gradientLayer];
  101. [konwBut mas_makeConstraints:^(MASConstraintMaker *make) {
  102. make.height.mas_equalTo(48);
  103. make.width.mas_equalTo(160.f);
  104. make.centerX.mas_equalTo(0.f);
  105. make.bottom.mas_equalTo(-30);
  106. }];
  107. UIButton *colseBut = [[UIButton alloc] init];
  108. [colseBut setImage:[UIImage imageNamed:@"common_del_white"] forState:UIControlStateNormal];
  109. [colseBut addTarget:self action:@selector(colseFun) forControlEvents:UIControlEventTouchUpInside];
  110. [self addSubview:colseBut];
  111. [colseBut mas_makeConstraints:^(MASConstraintMaker *make) {
  112. make.height.mas_equalTo(48);
  113. make.width.mas_equalTo(48.f);
  114. make.centerX.mas_equalTo(0.f);
  115. make.top.mas_equalTo(_whiteBgView.mas_bottom).offset(30);
  116. }];
  117. }
  118. - (void)colseFun
  119. {
  120. NSString *datestr = [iTools getNowDateString];
  121. [HWDataManager setObjectWithKey:Const_did_show_image_version_date value:datestr];
  122. [self removeFromSuperview];
  123. }
  124. @end