// // YOUPAILZGameCertificationVC.m // VQU // // Created by CY on 2021/4/26. // Copyright © 2021 leo. All rights reserved. // #import "YOUPAILZGameCertificationVC.h" #import "YOUPAILZGameModel.h" #import "YOUPAILZUploadGameImageView.h" #import "YOUPAILZWriteGameInfoView.h" @interface YOUPAILZGameCertificationVC () @property (nonatomic, strong)NSMutableArray *youpaipimgVs; @property (nonatomic, strong)NSMutableArray *youpaiplabs; @property (nonatomic, weak)UIScrollView *youpaipscrollView; @property (nonatomic, weak)YOUPAILZUploadGameImageView *youpaipuploadGameImageView; @property (nonatomic, weak)YOUPAILZWriteGameInfoView *youpaipwriteGameInfoView; @end @implementation YOUPAILZGameCertificationVC - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; self.title = self.youpaipgameModel.youpaipname; self.youpaipimgVs = [NSMutableArray array]; self.youpaiplabs = [NSMutableArray array]; [self youpaifsetupUI]; } - (void)youpaifsetupUI{ NSArray *contents = @[ @"游戏认证", @"填写资料", @"平台审核" ]; UIView *bgV = [[UIView alloc] init];; [self.view addSubview:bgV]; [bgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.offset(0.0f); make.top.offset(NavBarHeight + 20.0f); make.height.offset(22.0f); }]; for (NSInteger i = 0; i < contents.count; i++) { UIImageView *imgV = [[UIImageView alloc] init]; imgV.image = [UIImage imageNamed:@"vqu_images_game_certification_nol"]; [bgV addSubview:imgV]; [self.youpaipimgVs addObject:imgV]; [imgV mas_makeConstraints:^(MASConstraintMaker *make) { if(i == 0){ make.left.offset(ScaleSize(42.0f)); }else if (i == 1){ make.centerX.equalTo(bgV.mas_centerX); }else{ make.right.offset(-ScaleSize(42.0f)); } make.centerY.offset(0); }]; UILabel *lab = [[UILabel alloc] init]; lab.font = LCFont15; lab.text = contents[i]; lab.textColor = HexColorFromRGB(0xCCCCCC); [self.view addSubview:lab]; [self.youpaiplabs addObject:lab]; [lab mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(bgV.mas_bottom).offset(7.0f); make.centerX.equalTo(imgV.mas_centerX); }]; } for (NSInteger i = 0; i < self.youpaipimgVs.count - 1; i ++) { UIView *lineV = [[UIView alloc] init]; lineV.backgroundColor = [HexColorFromRGB(0xCCCCCC) colorWithAlphaComponent:0.15f]; [self.view addSubview:lineV]; [lineV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.youpaipimgVs[i].mas_right).offset(10.0f); make.right.equalTo(self.youpaipimgVs[i + 1].mas_left).offset(-10.0f); make.height.offset(1.0f); make.centerY.equalTo(self.youpaipimgVs[i].mas_centerY); }]; } UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, NavBarHeight + 85.0f, KScreenWidth, KScreenHeight - (NavBarHeight + 85.0f))]; scrollView.showsVerticalScrollIndicator = NO; scrollView.showsHorizontalScrollIndicator = NO; scrollView.delegate = self; scrollView.scrollEnabled = NO; [self.view addSubview:scrollView]; self.youpaipscrollView = scrollView; YOUPAILZUploadGameImageView *uploadGameImageView = [[YOUPAILZUploadGameImageView alloc] initWithModel:self.youpaipgameModel]; self.youpaipuploadGameImageView = uploadGameImageView; YOUPAILZWriteGameInfoView *writeGameInfoView = [[YOUPAILZWriteGameInfoView alloc] initWithModel:self.youpaipgameModel]; self.youpaipwriteGameInfoView = writeGameInfoView; NSArray *contentVs = @[uploadGameImageView,writeGameInfoView]; for (NSInteger i = 0; i < contentVs.count; i ++) { UIView *v = contentVs[i]; v.frame = CGRectMake(i * KScreenWidth, 0, KScreenWidth, scrollView.mj_h); [scrollView addSubview:v]; } scrollView.contentSize = CGSizeMake(contentVs.count * KScreenWidth, scrollView.mj_h); [self youpaifsetCurrentIndex:self.youpaipindex]; } - (void)youpaifsetCurrentIndex:(NSInteger)index{ if (index == 0) { UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(0, 0, 56.0f, 24.0f); btn.layer.cornerRadius = 12.0f; btn.clipsToBounds = YES; btn.backgroundColor = ZYPinkColor; btn.titleLabel.font = LCFont12; [btn setTitle:@"下一步" forState:UIControlStateNormal]; [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [btn addTarget:self action:@selector(youpaifnavBtnClick) forControlEvents:UIControlEventTouchUpInside]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn]; }else{ self.navigationItem.rightBarButtonItem = nil; } for (NSInteger i = 0; i < self.youpaipimgVs.count; i ++) { if (i <= index) { self.youpaipimgVs[i].image = [UIImage imageNamed:@"vqu_images_game_certification_sel"]; }else{ self.youpaipimgVs[i].image = [UIImage imageNamed:@"vqu_images_game_certification_nol"]; } } for (NSInteger i = 0; i < self.youpaiplabs.count; i ++) { if (i <= index) { self.youpaiplabs[i].textColor = HexColorFromRGB(0x333333); }else{ self.youpaiplabs[i].textColor = HexColorFromRGB(0xCCCCCC); } } self.youpaipscrollView.contentOffset = CGPointMake(index * KScreenWidth, 0); } - (void)youpaifnavBtnClick{ if (self.youpaipgameModel.youpaipselectedImage != nil) { YOUPAILZGameCertificationVC *vc = [[YOUPAILZGameCertificationVC alloc] init]; vc.youpaipgameModel = self.youpaipgameModel; vc.youpaipindex = 1; [self.navigationController pushViewController:vc animated:YES]; }else{ [ZCHUDHelper showTitle:@"请上传技能图"]; } } @end