NoEnoughTimeViewController.m 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. //
  2. // NoEnoughTimeViewController.m
  3. // 隐私保护
  4. //
  5. // Created by APPLE on 2023/8/30.
  6. //
  7. #import "NoEnoughTimeViewController.h"
  8. #import <Masonry.h>
  9. @interface NoEnoughTimeViewController ()
  10. @end
  11. @implementation NoEnoughTimeViewController
  12. @synthesize delegate;
  13. @synthesize privilegeList;
  14. @synthesize expirationReminder;/*云机到期会保留数据多少天*/
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. // Do any additional setup after loading the view.
  18. [self drawAnyView];
  19. }
  20. - (void)drawAnyView{
  21. [self.view setBackgroundColor:HW000000Color60];
  22. [self.toolBar setHidden:YES];
  23. [self.navigationBar setHidden:YES];
  24. UIImageView *alertBg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"new_people_welfare_bg"]];
  25. [alertBg setUserInteractionEnabled:YES];
  26. [self.view addSubview:alertBg];
  27. [alertBg mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.centerY.equalTo(self.view.mas_centerY).offset(-30*HAUTOSCALE);
  29. make.centerX.equalTo(self.view.mas_centerX);
  30. make.width.mas_equalTo(324);
  31. make.height.mas_equalTo(323);
  32. }];
  33. // @synthesize privilegeList;
  34. // @synthesize expirationReminder;/*云机到期会保留数据多少天*/
  35. NSString *leftStr = NSLocalizedString(@"no_enough_time_vip_tips",nil);
  36. NSString *medileStr = [NSString stringWithFormat:@"%ld",expirationReminder];
  37. NSString *rightStr = NSLocalizedString(@"buy_vip_package_detail_day",nil);
  38. NSString *strShow = [[leftStr stringByAppendingString:medileStr] stringByAppendingString:rightStr];
  39. /*即将过期*/
  40. UILabel *topLabel = [[UILabel alloc] init];
  41. [topLabel setText:strShow];
  42. [topLabel setTextColor:HW0458E3Color];
  43. [topLabel setFont:[UIFont boldSystemFontOfSize:18.f]];
  44. [alertBg addSubview:topLabel];
  45. [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.top.mas_equalTo(44.f);
  47. make.left.mas_equalTo(40.f);
  48. }];
  49. UILabel *detaileLabel = [[UILabel alloc] init];
  50. [detaileLabel setFont:[UIFont boldSystemFontOfSize:12]];
  51. [alertBg addSubview:detaileLabel];
  52. [detaileLabel setTextColor:HW2F3972Color];
  53. [detaileLabel setText:NSLocalizedString(@"no_enough_time_lost_vip",nil)];
  54. [detaileLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.top.mas_equalTo(76.f);
  56. make.left.mas_equalTo(40.f);
  57. }];
  58. UIImageView *alertMiddleBg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"new_people_welfare_middle_bg"]];
  59. [alertBg addSubview:alertMiddleBg];
  60. [alertMiddleBg mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.top.mas_equalTo(120.f);
  62. make.centerX.equalTo(alertBg.mas_centerX);
  63. make.width.mas_equalTo(240);
  64. make.height.mas_equalTo(33);
  65. }];
  66. /*会员特权*/
  67. UILabel *middleTopLabel = [[UILabel alloc] init];
  68. [middleTopLabel setTextColor:HWFFFFFFColor];
  69. [middleTopLabel setFont:[UIFont systemFontOfSize:12.f]];
  70. [middleTopLabel setTextAlignment:(NSTextAlignmentCenter)];
  71. [alertBg addSubview:middleTopLabel];
  72. [middleTopLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  73. make.top.mas_equalTo(126.f);
  74. make.centerX.equalTo(alertBg.mas_centerX);
  75. }];
  76. [middleTopLabel setText:NSLocalizedString(@"buy_home_fun_title",nil)];
  77. /*功能列表*/
  78. for (NSInteger nFori = 0; nFori < privilegeList.count; nFori++) {
  79. UIButton *flagBtn = [[UIButton alloc] init];
  80. [flagBtn setImage:[UIImage imageNamed:@"buy_home_flag_fun"] forState:(UIControlStateNormal)];
  81. [flagBtn setTitleColor:HW666666Color forState:(UIControlStateNormal)];
  82. [flagBtn.titleLabel setFont:[UIFont systemFontOfSize:12.f]];
  83. [flagBtn setTitle:[privilegeList objectAtIndex:nFori] forState:(UIControlStateNormal)];
  84. [flagBtn setContentHorizontalAlignment:(UIControlContentHorizontalAlignmentLeft)];
  85. [alertBg addSubview:flagBtn];
  86. /*计算位置*/
  87. NSInteger x_place = nFori%2;
  88. NSInteger y_palce = nFori/2;
  89. [flagBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  90. if (x_place == 0){
  91. make.left.mas_equalTo(55.f);
  92. }else{
  93. make.left.equalTo(alertBg.mas_centerX).offset(10);
  94. }
  95. make.width.mas_equalTo(140);
  96. make.top.mas_equalTo(157 + y_palce*(18.f+8.f));
  97. make.height.mas_equalTo(18);
  98. }];
  99. }
  100. /*续费按钮*/
  101. UIButton *exchangeBtn = [[UIButton alloc] init];
  102. exchangeBtn.frame = CGRectMake(0, 0, 120.f, 36.f);
  103. // gradient
  104. CAGradientLayer *gl = [CAGradientLayer layer];
  105. gl.frame = CGRectMake(0,0,120.f,36.f);
  106. gl.startPoint = CGPointMake(0, 0.5);
  107. gl.endPoint = CGPointMake(1, 0.5);
  108. gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  109. gl.locations = @[@(0), @(1.0f)];
  110. [exchangeBtn.layer addSublayer:gl];
  111. [exchangeBtn addTarget:self action:@selector(exchangeBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
  112. [exchangeBtn setTitle:NSLocalizedString(@"no_enough_time_exchange",nil) forState:(UIControlStateNormal)];
  113. [exchangeBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  114. [exchangeBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
  115. [exchangeBtn.layer setCornerRadius:8.f];
  116. exchangeBtn.clipsToBounds = YES;
  117. [alertBg addSubview:exchangeBtn];
  118. [exchangeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  119. make.left.equalTo(self.view.mas_centerX).offset(6);
  120. make.width.mas_equalTo(120.f);
  121. make.bottom.mas_equalTo(-20.f);
  122. make.height.mas_equalTo(36.f);
  123. }];
  124. /*残忍拒绝*/
  125. UIButton *noExchangeBtn = [[UIButton alloc] init];
  126. [noExchangeBtn addTarget:self action:@selector(noExchangeBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
  127. [noExchangeBtn setTitle:NSLocalizedString(@"no_enough_time_no_exchange",nil) forState:(UIControlStateNormal)];
  128. [noExchangeBtn setTitleColor:HW999999Color forState:(UIControlStateNormal)];
  129. [noExchangeBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
  130. [noExchangeBtn.layer setCornerRadius:8.f];
  131. [noExchangeBtn setBackgroundColor:HWE3E8F1Color];
  132. noExchangeBtn.clipsToBounds = YES;
  133. [alertBg addSubview:noExchangeBtn];
  134. [noExchangeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  135. make.right.equalTo(self.view.mas_centerX).offset(-6);
  136. make.width.mas_equalTo(120.f);
  137. make.bottom.mas_equalTo(-20.f);
  138. make.height.mas_equalTo(36.f);
  139. }];
  140. }
  141. //- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
  142. // [self dismissViewControllerAnimated:YES completion:^{
  143. // ;
  144. // }];
  145. //}
  146. - (void)exchangeBtnClick{
  147. [self dismissViewControllerAnimated:YES completion:^{
  148. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  149. if ([self->delegate respondsToSelector:@selector(exchangeBtnClickPressed)]){
  150. [self->delegate exchangeBtnClickPressed];
  151. }
  152. });
  153. }];
  154. }
  155. - (void)noExchangeBtnClick{
  156. [self dismissViewControllerAnimated:YES completion:^{
  157. ;
  158. }];
  159. }
  160. /*
  161. #pragma mark - Navigation
  162. // In a storyboard-based application, you will often want to do a little preparation before navigation
  163. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  164. // Get the new view controller using [segue destinationViewController].
  165. // Pass the selected object to the new view controller.
  166. }
  167. */
  168. @end