首次提交
This commit is contained in:
94
SweetParty/主类/Mine/青少年模式/YXYoungUseViewController.m
Executable file
94
SweetParty/主类/Mine/青少年模式/YXYoungUseViewController.m
Executable file
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// YXYoungUseViewController.m
|
||||
// romantic
|
||||
//
|
||||
// Created by MAC on 2022/12/15.
|
||||
// Copyright © 2022 romantic. All rights reserved.
|
||||
//
|
||||
|
||||
#import "YXYoungUseViewController.h"
|
||||
#import "YXYoungUseView.h"
|
||||
#import "YXYoungSetPwViewController.h"
|
||||
#import "YXYoungSetPwView.h"
|
||||
|
||||
@interface YXYoungUseViewController ()
|
||||
|
||||
@property (nonatomic,strong) YXYoungUseView *userView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation YXYoungUseViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
UIImageView *bgImg = [ControlCreator createImageView:self.view rect:CGRectMake(0, 0, APPW, APPH) imageName:@"party_bg" backguoundColor:nil];
|
||||
bgImg.contentMode = UIViewContentModeScaleToFill;
|
||||
[self initNavBar];
|
||||
[self.view addSubview:self.userView];
|
||||
}
|
||||
|
||||
- (void)initNavBar {
|
||||
self.navTitle = @"青少年模式";
|
||||
[self.customNavBar styleClear];
|
||||
[self.customNavBar.left0Btn setImage:ImageNamed(@"blackBack") forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
- (YXYoungUseView *)userView {
|
||||
if(_userView == nil) {
|
||||
_userView = [[YXYoungUseView alloc] initWithFrame:CGRectMake(0, 0, APPW, APPH)];
|
||||
[self.view addSubview:self.userView];
|
||||
|
||||
[self.userView.submitButton addTarget:self
|
||||
action:@selector(submitButtonAction:)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
[self.userView.agreeButton addTarget:self
|
||||
action:@selector(agreeButtonAction:)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
if (self.type == 1) {
|
||||
self.userView.nameLabel.text = @"青少年模式已关闭";
|
||||
[self.userView.submitButton setTitle:@"开启青少年模式" forState:0];
|
||||
self.userView.agreeButton.hidden = self.userView.delegateLabel.hidden = NO;
|
||||
self.userView.iconImageView.image = ImageNamed(@"young_dunpai");
|
||||
} else {
|
||||
self.userView.nameLabel.text = @"青少年模式已开启";
|
||||
[self.userView.submitButton setTitle:@"关闭青少年模式" forState:0];
|
||||
self.userView.agreeButton.hidden = self.userView.delegateLabel.hidden = YES;
|
||||
self.userView.iconImageView.image = ImageNamed(@"young_dunpai_sel");
|
||||
|
||||
}
|
||||
}
|
||||
return _userView;
|
||||
}
|
||||
|
||||
- (void)submitButtonAction:(UIButton *)sender {
|
||||
if (self.type == 1) {
|
||||
if (_userView.agreeButton.isSelected == NO) {
|
||||
[HelpPageDefine showMessage:@"请先阅读并同意协议"];
|
||||
return;
|
||||
}
|
||||
// YXYoungSetPwViewController *vc = [YXYoungSetPwViewController new];
|
||||
// vc.type = 1;//开启青少年模式
|
||||
// [vc pushSelf];
|
||||
|
||||
YXYoungSetPwView *view = [[YXYoungSetPwView alloc] initWithFrame:CGRectMake(0, 0, APPW, APPH)];
|
||||
view.type = 1;
|
||||
[MainWindow() addSubview:view];
|
||||
} else {
|
||||
// YXYoungSetPwViewController *vc = [YXYoungSetPwViewController new];
|
||||
// vc.type = 2;//关闭青少年模式
|
||||
// [vc pushSelf];
|
||||
|
||||
YXYoungSetPwView *view = [[YXYoungSetPwView alloc] initWithFrame:CGRectMake(0, 0, APPW, APPH)];
|
||||
view.type = 2;
|
||||
[MainWindow() addSubview:view];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)agreeButtonAction:(UIButton *)sender {
|
||||
sender.selected = !sender.selected;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user