// // NewPeopleWelfareViewController.m // 隐私保护 // // Created by APPLE on 2023/8/30. // #import "NewPeopleWelfareViewController.h" #import @interface NewPeopleWelfareViewController () @end @implementation NewPeopleWelfareViewController @synthesize delegate; - (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); }]; /*新人福利*/ UILabel *topLabel = [[UILabel alloc] init]; [topLabel setText:NSLocalizedString(@"new_people_welfare_title",nil)]; [topLabel setTextColor:HW0458E3Color]; [topLabel setFont:[UIFont boldSystemFontOfSize:26.f]]; [alertBg addSubview:topLabel]; [topLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(41.f); make.left.mas_equalTo(40.f); }]; NSInteger welfareDay = 3; NSString *leftStr = @"赠送您"; NSString *medileStr = @"三天"; NSString *rightStr = @"的试用会员"; UILabel *detaileLabel = [[UILabel alloc] init]; [detaileLabel setFont:[UIFont boldSystemFontOfSize:12]]; [alertBg addSubview:detaileLabel]; [detaileLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(76.f); make.left.mas_equalTo(40.f); }]; NSString *showStr = [[leftStr stringByAppendingString:medileStr] stringByAppendingString:rightStr]; NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:showStr attributes: @{NSForegroundColorAttributeName:HW2F3972Color}]; [string addAttributes:@{NSForegroundColorAttributeName:HWDD4E4EColor} range:NSMakeRange(leftStr.length, medileStr.length)]; [detaileLabel setAttributedText:string]; 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)]; /*功能列表*/ NSArray *titleAry = @[@"11111",@"22222",@"33333",@"444444",@"5555",@"66666"]; for (NSInteger nFori = 0; nFori < titleAry.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:[titleAry 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 *downBtn = [[UIButton alloc] init]; downBtn.frame = CGRectMake(0, 0, 184.f, 36.f); // gradient CAGradientLayer *gl = [CAGradientLayer layer]; gl.frame = CGRectMake(0,0,184.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)]; [downBtn.layer addSublayer:gl]; [downBtn addTarget:self action:@selector(downBtnBtnClick) forControlEvents:(UIControlEventTouchUpInside)]; [downBtn setTitle:NSLocalizedString(@"new_people_welfare_start_use",nil) forState:(UIControlStateNormal)]; [downBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; [downBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]]; [downBtn.layer setCornerRadius:8.f]; downBtn.clipsToBounds = YES; [alertBg addSubview:downBtn]; [downBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.view.mas_centerX); make.width.mas_equalTo(184.f); make.bottom.mas_equalTo(-20.f); make.height.mas_equalTo(36.f); }]; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [self dismissViewControllerAnimated:YES completion:^{ ; }]; } - (void)downBtnBtnClick{ [self dismissViewControllerAnimated:YES completion:^{ if ([self->delegate respondsToSelector:@selector(downBtnBtnClickPressed)]){ [self->delegate downBtnBtnClickPressed]; } }]; } /* #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