Files
featherVoice/QXLive/Tabbar/弹窗/QXChirldPopView.m
2025-08-08 10:49:36 +08:00

129 lines
4.6 KiB
Objective-C

//
// QXChirldPopView.m
// QXLive
//
// Created by 启星 on 2025/5/8.
//
#import "QXChirldPopView.h"
@interface QXChirldPopView()
@property (nonatomic,strong)UIImageView*bgImageView;
@property (nonatomic,strong)UILabel*titleLabel;
@property (nonatomic,strong)UILabel*contentLabel;
@property (nonatomic,strong)UIButton*goBtn;
@property (nonatomic,strong)UIButton*closeBtn;
@property (nonatomic,strong)UIButton *setBtn;
@end
@implementation QXChirldPopView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
}
return self;
}
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, ScaleWidth(275), ScaleWidth(365+48));
[self initSubViews];
}
return self;
}
-(void)initSubViews{
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a_pop_chirld_mode"]];
[self addSubview:self.bgImageView];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.text = QXText(@"青少年模式");
self.titleLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.titleLabel];
self.contentLabel = [[UILabel alloc] init];
self.contentLabel.numberOfLines = 0;
self.contentLabel.font = [UIFont boldSystemFontOfSize:14];
self.contentLabel.textColor = RGB16(0x666666);
self.contentLabel.text = QXText(@"为了呵护未成年人健康成长,蜜耳语音特别推出青少年模式,该模式下部分功能无法正常使用,请监护人主动选择并设置监护密码");
[self addSubview:self.contentLabel];
self.goBtn = [[UIButton alloc] init];
[self.goBtn setTitleColor:RGB16(0xF4DF39) forState:(UIControlStateNormal)];
[self.goBtn setTitle:[NSString stringWithFormat:@"%@>",QXText(@"进入青少年模式")] forState:(UIControlStateNormal)];
self.goBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.goBtn addTarget:self action:@selector(gotoChirld) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.goBtn];
self.closeBtn = [[UIButton alloc] init];
[self.closeBtn setBackgroundImage:[UIImage imageNamed:@"home_white_close"] forState:(UIControlStateNormal)];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.closeBtn];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerX.equalTo(self);
make.size.mas_equalTo(CGSizeMake(ScaleWidth(275), ScaleWidth(365)));
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.top.mas_equalTo(ScaleWidth(163));
make.height.mas_equalTo(24);
}];
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(13);
make.right.equalTo(self).offset(-13);
make.top.equalTo(self.titleLabel.mas_bottom).offset(10);
}];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.top.equalTo(self.bgImageView.mas_bottom).offset(8);
make.height.width.mas_equalTo(30);
}];
//
[self.goBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.height.mas_equalTo(30);
make.bottom.equalTo(self.bgImageView.mas_bottom).offset(-55);
}];
self.setBtn = [[UIButton alloc] init];
[self.setBtn addRoundedCornersWithRadius:21];
self.setBtn.backgroundColor = QXConfig.themeColor;
[self.setBtn setTitle:QXText(@"设置青少年模式") forState:(UIControlStateNormal)];
[self.setBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
self.setBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.setBtn addTarget:self action:@selector(setAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.setBtn];
[self.setBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bgImageView).offset(-12);
make.height.mas_equalTo(42);
make.right.equalTo(self.bgImageView).offset(-48);
make.left.equalTo(self.bgImageView).offset(48);
}];
}
-(void)gotoChirld{
if (self.gotoActionBlock) {
self.gotoActionBlock();
}
}
-(void)closeAction{
if (self.closeActionBlock) {
self.closeActionBlock();
}
}
-(void)setAction{
if (self.setActionBlock) {
self.setActionBlock();
}
}
@end