// // YOUPAILPYoungOpenWindow.m // livePro // // Created by leo on 2019/12/26. // Copyright © 2019 caiPro. All rights reserved. // #import "YOUPAILPYoungOpenWindow.h" #import "NSString+YYAdd.h" #import "YOUPAILPYoungPwdVC.h" @interface YOUPAILPYoungOpenWindow () @property(nonatomic,assign)CGFloat youpaiplefpadding,youpaipimgVHeight,youpaipimgVWidth,youpaiptitleHeight; @property(nonatomic,strong)UIImageView *youpaipimgV; @property(nonatomic,strong)UIButton *youpaipopenBtn; @property(nonatomic,strong)UILabel *youpaiptitleLab,*youpaipnoticeLab; @end @implementation YOUPAILPYoungOpenWindow - (void)viewDidLoad { [super viewDidLoad]; // [self.view setFrame:CGRectMake(0, 0, _vWith, _vHeight)]; // CAShapeLayer *maskLayer = [CAShapeLayer layer]; // UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.view.bounds cornerRadius:25]; // maskLayer.path = path.CGPath; // self.view.layer.mask = maskLayer; // [self.view setBackgroundColor:[UIColor whiteColor]]; _youpaipimgVWidth = self.vWidth; _youpaipimgVHeight = 257* self.vWidth/640.0; _youpaiplefpadding = (KScreenWidth-_youpaipimgVWidth)/2.0; [self.baseView addSubview:self.youpaipimgV]; [self.baseView addSubview:self.youpaiptitleLab]; [self.baseView addSubview:self.youpaipopenBtn]; [self.baseView addSubview:self.youpaipnoticeLab]; NSString *titleStr = @"为呵护未成年人健康成长\n我们已推出青少年模式"; [_youpaiptitleLab setText:titleStr]; CGSize titleSize = [titleStr sizeForFont:LCBoldFont(16) size:CGSizeMake(self.vWidth, 200) mode:NSLineBreakByWordWrapping]; _youpaiptitleHeight = titleSize.height; [_youpaipnoticeLab setText:@"设置未成年模式>"]; [_youpaipopenBtn setTitle:@"不再提醒" forState:UIControlStateNormal]; [_youpaiptitleLab mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.baseView).with.offset(25); make.right.equalTo(self.baseView).with.offset(-25); make.top.equalTo(_youpaipimgV.mas_bottom).with.offset(24); make.height.mas_equalTo(_youpaiptitleHeight); }]; [_youpaipopenBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.baseView); make.top.equalTo(_youpaiptitleLab.mas_bottom).with.offset(20); make.size.mas_equalTo(CGSizeMake(240.0f, 48)); }]; [_youpaipopenBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(240.0f, 48) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:1] forState:UIControlStateNormal]; [_youpaipnoticeLab mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.baseView).with.offset(0); make.right.equalTo(self.baseView).with.offset(0); make.top.equalTo(_youpaipopenBtn.mas_bottom).with.offset(20); make.height.mas_equalTo(20); }]; UIButton *youpaipForgetPasswordBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [youpaipForgetPasswordBtn setImage:[UIImage imageNamed:@"vqu_images_home_tv_desc_n"] forState:UIControlStateNormal]; [youpaipForgetPasswordBtn setTitle:@"进入青少年模式" forState:UIControlStateNormal]; [youpaipForgetPasswordBtn setTitleColor:LZA3AABEColor forState:UIControlStateNormal]; youpaipForgetPasswordBtn.titleLabel.font = LCFont(13.0f); [youpaipForgetPasswordBtn addTarget:self action:@selector(youpaifsettingPWD) forControlEvents:UIControlEventTouchUpInside]; [youpaipForgetPasswordBtn setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft]; [self.baseView addSubview:youpaipForgetPasswordBtn]; [youpaipForgetPasswordBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.baseView); make.top.equalTo(_youpaipopenBtn.mas_bottom).offset(16); make.size.mas_offset(CGSizeMake(108.0f, 18.0f)); }]; // Do any additional setup after loading the view. } -(UIImageView *)youpaipimgV { if(!_youpaipimgV) { _youpaipimgV = [[UIImageView alloc]initWithFrame:CGRectMake((self.vWidth-135)/2, 20, 135, 135)]; [_youpaipimgV setImage:[UIImage imageNamed:@"vqu_images_juvenile_2"]]; } return _youpaipimgV; } -(UILabel *)youpaiptitleLab { if(!_youpaiptitleLab) { _youpaiptitleLab = [[UILabel alloc]init]; [_youpaiptitleLab setTextColor:LZ273145Color]; [_youpaiptitleLab setFont:LCBoldFont(16)]; _youpaiptitleLab.numberOfLines = 0; _youpaiptitleLab.lineBreakMode = NSLineBreakByWordWrapping; [_youpaiptitleLab setTextAlignment:NSTextAlignmentCenter]; } return _youpaiptitleLab; } -(UIButton *)youpaipopenBtn { if(!_youpaipopenBtn) { _youpaipopenBtn = [[UIButton alloc]init]; [_youpaipopenBtn.titleLabel setFont:LCFont16]; _youpaipopenBtn.layer.cornerRadius = 24; _youpaipopenBtn.layer.masksToBounds = YES; [_youpaipopenBtn addTarget:self action:@selector(youpaifcancelWindow) forControlEvents:UIControlEventTouchUpInside]; [_youpaipopenBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; } return _youpaipopenBtn; } -(void)youpaifsettingPWD { [self dismissViewControllerAnimated:YES completion:^{ if ([self.youpaipdelegate respondsToSelector:@selector(youpaifyoungSettingPwd)]) { [self.youpaipdelegate youpaifyoungSettingPwd]; } }]; } -(void)youpaifcancelWindow { [self dismissViewControllerAnimated:YES completion:nil]; } /* #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