123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- //
- // NoEnoughTimeViewController.m
- // 隐私保护
- //
- // Created by APPLE on 2023/8/30.
- //
- #import "NoEnoughTimeViewController.h"
- #import <Masonry.h>
- @interface NoEnoughTimeViewController ()
- @end
- @implementation NoEnoughTimeViewController
- @synthesize delegate;
- @synthesize privilegeList;
- @synthesize expirationReminder;/*云机到期会保留数据多少天*/
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
-
- [self drawAnyView];
- }
- - (void)drawAnyView{
- [self.view setBackgroundColor:HW000000Color60];
-
- [self.toolBar setHidden:YES];
- [self.navigationBar setHidden:YES];
-
- UIImageView *alertBg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"new_people_welfare_bg"]];
- [alertBg setUserInteractionEnabled:YES];
- [self.view addSubview:alertBg];
- [alertBg mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.view.mas_centerY).offset(-30*HAUTOSCALE);
- make.centerX.equalTo(self.view.mas_centerX);
- make.width.mas_equalTo(324);
- make.height.mas_equalTo(323);
- }];
-
- // @synthesize privilegeList;
- // @synthesize expirationReminder;/*云机到期会保留数据多少天*/
-
- NSString *leftStr = NSLocalizedString(@"no_enough_time_vip_tips",nil);
- NSString *medileStr = [NSString stringWithFormat:@"%ld",expirationReminder];
- NSString *rightStr = NSLocalizedString(@"buy_vip_package_detail_day",nil);
-
- NSString *strShow = [[leftStr stringByAppendingString:medileStr] stringByAppendingString:rightStr];
-
- /*即将过期*/
- UILabel *topLabel = [[UILabel alloc] init];
- [topLabel setText:strShow];
- [topLabel setTextColor:HW0458E3Color];
- [topLabel setFont:[UIFont boldSystemFontOfSize:18.f]];
- [alertBg addSubview:topLabel];
- [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(44.f);
- make.left.mas_equalTo(40.f);
- }];
-
- UILabel *detaileLabel = [[UILabel alloc] init];
- [detaileLabel setFont:[UIFont boldSystemFontOfSize:12]];
- [alertBg addSubview:detaileLabel];
- [detaileLabel setTextColor:HW2F3972Color];
- [detaileLabel setText:NSLocalizedString(@"no_enough_time_lost_vip",nil)];
- [detaileLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(76.f);
- make.left.mas_equalTo(40.f);
- }];
-
- UIImageView *alertMiddleBg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"new_people_welfare_middle_bg"]];
- [alertBg addSubview:alertMiddleBg];
- [alertMiddleBg mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(120.f);
- make.centerX.equalTo(alertBg.mas_centerX);
- make.width.mas_equalTo(240);
- make.height.mas_equalTo(33);
- }];
-
- /*会员特权*/
- UILabel *middleTopLabel = [[UILabel alloc] init];
- [middleTopLabel setTextColor:HWFFFFFFColor];
- [middleTopLabel setFont:[UIFont systemFontOfSize:12.f]];
- [middleTopLabel setTextAlignment:(NSTextAlignmentCenter)];
- [alertBg addSubview:middleTopLabel];
- [middleTopLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(126.f);
- make.centerX.equalTo(alertBg.mas_centerX);
- }];
- [middleTopLabel setText:NSLocalizedString(@"buy_home_fun_title",nil)];
-
- /*功能列表*/
- for (NSInteger nFori = 0; nFori < privilegeList.count; nFori++) {
- UIButton *flagBtn = [[UIButton alloc] init];
- [flagBtn setImage:[UIImage imageNamed:@"buy_home_flag_fun"] forState:(UIControlStateNormal)];
- [flagBtn setTitleColor:HW666666Color forState:(UIControlStateNormal)];
- [flagBtn.titleLabel setFont:[UIFont systemFontOfSize:12.f]];
- [flagBtn setTitle:[privilegeList objectAtIndex:nFori] forState:(UIControlStateNormal)];
- [flagBtn setContentHorizontalAlignment:(UIControlContentHorizontalAlignmentLeft)];
- [alertBg addSubview:flagBtn];
-
- /*计算位置*/
- NSInteger x_place = nFori%2;
- NSInteger y_palce = nFori/2;
- [flagBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- if (x_place == 0){
- make.left.mas_equalTo(55.f);
- }else{
- make.left.equalTo(alertBg.mas_centerX).offset(10);
- }
- make.width.mas_equalTo(140);
- make.top.mas_equalTo(157 + y_palce*(18.f+8.f));
- make.height.mas_equalTo(18);
- }];
- }
-
- /*续费按钮*/
- UIButton *exchangeBtn = [[UIButton alloc] init];
- exchangeBtn.frame = CGRectMake(0, 0, 120.f, 36.f);
- // gradient
- CAGradientLayer *gl = [CAGradientLayer layer];
- gl.frame = CGRectMake(0,0,120.f,36.f);
- gl.startPoint = CGPointMake(0, 0.5);
- gl.endPoint = CGPointMake(1, 0.5);
- gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
- gl.locations = @[@(0), @(1.0f)];
-
- [exchangeBtn.layer addSublayer:gl];
- [exchangeBtn addTarget:self action:@selector(exchangeBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
- [exchangeBtn setTitle:NSLocalizedString(@"no_enough_time_exchange",nil) forState:(UIControlStateNormal)];
- [exchangeBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
- [exchangeBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
- [exchangeBtn.layer setCornerRadius:8.f];
- exchangeBtn.clipsToBounds = YES;
- [alertBg addSubview:exchangeBtn];
- [exchangeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.view.mas_centerX).offset(6);
- make.width.mas_equalTo(120.f);
- make.bottom.mas_equalTo(-20.f);
- make.height.mas_equalTo(36.f);
- }];
-
- /*残忍拒绝*/
- UIButton *noExchangeBtn = [[UIButton alloc] init];
- [noExchangeBtn addTarget:self action:@selector(noExchangeBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
- [noExchangeBtn setTitle:NSLocalizedString(@"no_enough_time_no_exchange",nil) forState:(UIControlStateNormal)];
- [noExchangeBtn setTitleColor:HW999999Color forState:(UIControlStateNormal)];
- [noExchangeBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
- [noExchangeBtn.layer setCornerRadius:8.f];
- [noExchangeBtn setBackgroundColor:HWE3E8F1Color];
- noExchangeBtn.clipsToBounds = YES;
- [alertBg addSubview:noExchangeBtn];
- [noExchangeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.view.mas_centerX).offset(-6);
- make.width.mas_equalTo(120.f);
- make.bottom.mas_equalTo(-20.f);
- make.height.mas_equalTo(36.f);
- }];
- }
- //- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
- // [self dismissViewControllerAnimated:YES completion:^{
- // ;
- // }];
- //}
- - (void)exchangeBtnClick{
- [self dismissViewControllerAnimated:YES completion:^{
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- if ([self->delegate respondsToSelector:@selector(exchangeBtnClickPressed)]){
- [self->delegate exchangeBtnClickPressed];
- }
- });
- }];
- }
- - (void)noExchangeBtnClick{
- [self dismissViewControllerAnimated:YES completion:^{
- ;
- }];
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|