// // YXYoungUseView.m // romantic // // Created by MAC on 2022/12/15. // Copyright © 2022 romantic. All rights reserved. // #import "YXYoungUseView.h" #import "BJWebVC.h" @implementation YXYoungUseView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self setUI]; } return self; } - (void)setUI { self.iconImageView = [UIImageView new]; [self addSubview:self.iconImageView]; self.iconImageView.frame = CGRectMake(APPW * 0.5 - 125/2, yb_NavigationBar_H + 25, 125, 125); self.iconImageView.image = ImageNamed(@"young_dunpai"); self.nameLabel = [UILabel new]; [self addSubview:self.nameLabel]; self.nameLabel.frame = CGRectMake(32, CGRectGetMaxY(self.iconImageView.frame) + 12, APPW - 64, 22); self.nameLabel.textAlignment = NSTextAlignmentCenter; self.nameLabel.font = YBBoldFont(17); self.nameLabel.text = @"青少年模式"; self.nameLabel.textColor = HEXCOLOR(0x000126); self.coverView = [UIView new]; [self addSubview:self.coverView]; self.coverView.frame = CGRectMake(15, CGRectGetMaxY(self.nameLabel.frame) + 30, APPW - 30, 250); self.coverView.layer.cornerRadius = 14; self.coverView.layer.masksToBounds = YES; self.coverView.backgroundColor = kClearColor; self.nameOne = [YYLabel new]; [self.coverView addSubview:self.nameOne]; self.nameOne.frame = CGRectMake(34, 22, APPW - 30 - 34 -20, 35); self.nameOne.text = @"1、在青少年模式中,我们在首页精选了一些教育类、知识类内容,且无法开启直播功能;"; self.nameOne.numberOfLines = 0; self.nameOne.font = YBMediumFont(13); self.nameOne.textVerticalAlignment = YYTextVerticalAlignmentTop; self.nameOne.textAlignment = NSTextAlignmentLeft; self.oneDot = [UIImageView new]; [self.coverView addSubview:self.oneDot]; self.oneDot.sd_layout.topEqualToView(self.nameOne).leftSpaceToView(self.coverView, 16).widthIs(10).heightIs(10); self.oneDot.image = ImageNamed(@"young_detail_dot"); self.oneDot.hidden = YES; self.nameTwo = [YYLabel new]; [self.coverView addSubview:self.nameTwo]; self.nameTwo.frame = CGRectMake(34, CGRectGetMaxY(self.nameOne.frame) + 35, APPW - 30 - 34 -20, 54); self.nameTwo.text = @"2、开启青少年模式后,将自动为您开启时间锁,单日使用时间不超过40分钟,晚上10点至早上6点无法使用;"; self.nameTwo.numberOfLines = 0; self.nameTwo.font = YBMediumFont(13); self.nameTwo.textVerticalAlignment = YYTextVerticalAlignmentTop; self.nameTwo.textAlignment = NSTextAlignmentLeft; self.twoDot = [UIImageView new]; [self.coverView addSubview:self.twoDot]; self.twoDot.sd_layout.topEqualToView(self.nameTwo).leftSpaceToView(self.coverView, 16).widthIs(10).heightIs(10); self.twoDot.image = ImageNamed(@"young_detail_dot"); self.twoDot.hidden = YES; self.nameThree = [YYLabel new]; [self.coverView addSubview:self.nameThree]; self.nameThree.frame = CGRectMake(34, CGRectGetMaxY(self.nameTwo.frame) + 35, APPW - 30 - 34 -20, 56); self.nameThree.text = @"3、青少年模式下收集的所有用户(包括可能的14周岁以上的用户)的个人信息,平台承诺将均按照《平台儿童个人信息保护规则》进行处理和保护。"; self.nameThree.numberOfLines = 0; self.nameThree.font = YBMediumFont(13); self.nameThree.textVerticalAlignment = YYTextVerticalAlignmentTop; self.nameThree.textAlignment = NSTextAlignmentLeft; self.threeDot = [UIImageView new]; [self.coverView addSubview:self.threeDot]; self.threeDot.sd_layout.topEqualToView(self.nameThree).leftSpaceToView(self.coverView, 16).widthIs(10).heightIs(10); self.threeDot.image = ImageNamed(@"young_detail_dot"); self.threeDot.hidden = YES; [self setBottomUI]; self.nameOne.textColor = self.nameTwo.textColor = self.nameThree.textColor = HEXCOLOR(0x000126); } - (void)setBottomUI { self.delegateLabel = [YYLabel new]; [self addSubview:self.delegateLabel]; self.delegateLabel.frame = CGRectMake(54, APPH - 140, APPW - 54 - 0, 15); self.delegateLabel.numberOfLines = 2; NSString *string = @"我已认真阅读并同意《语音儿童个人信息保护规则》"; NSMutableAttributedString *arrString = [[NSMutableAttributedString alloc] initWithString:string attributes:@{NSFontAttributeName: YBFont(12),NSForegroundColorAttributeName: HEXCOLOR(0x333333)}]; NSRange range = [string rangeOfString:@"《语音儿童个人信息保护规则》"]; [arrString yy_setColor:HEXCOLOR(0x00B682) range:range]; [arrString yy_setTextHighlightRange:range color:HEXCOLOR(0x00B682) backgroundColor:kClearColor tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { NSLog(@"被点击"); BJWebVC *vc = [[BJWebVC alloc] init]; vc.webUrl = [NSString stringWithFormat:@"%@%@", VERSION_HTTPS_SERVER, @"index.php/index/index/page_show?id=10"]; [vc pushSelf]; }]; self.delegateLabel.attributedText = arrString; self.delegateLabel.textVerticalAlignment = YYTextVerticalAlignmentTop; self.delegateLabel.textAlignment = NSTextAlignmentLeft; self.agreeButton = [UIButton buttonWithType:UIButtonTypeCustom]; [self addSubview:self.agreeButton]; self.agreeButton.sd_layout.widthIs(40).heightIs(40).rightSpaceToView(self.delegateLabel, 5).topEqualToView(self.delegateLabel); self.agreeButton.imageView.sd_layout.rightEqualToView(self.agreeButton).topEqualToView(self.agreeButton).widthIs(13).heightIs(13); [self.agreeButton setImage:ImageNamed(@"xieyi_nor") forState:0]; [self.agreeButton setImage:ImageNamed(@"xieyi_sel") forState:UIControlStateSelected]; self.submitButton = [UIButton buttonWithType:UIButtonTypeCustom]; [self addSubview:self.submitButton]; self.submitButton.sd_layout.centerXEqualToView(self).bottomSpaceToView(self, 60).heightIs(48).widthIs(APPW - 68); self.submitButton.sd_cornerRadius = @(24); [self.submitButton setJianBianWithCGSize:CGSizeMake(APPW - 68, 48)]; [self.submitButton setTitleColor:kBlackColor forState:0]; [self.submitButton setTitle:@"开启青少年模式" forState:0]; self.submitButton.titleLabel.font = YBBoldFont(16); } @end