// // YOUPAILZUploadGameImageView.m // VQU // // Created by CY on 2021/4/26. // Copyright © 2021 leo. All rights reserved. // #import "YOUPAILZUploadGameImageView.h" #import "YOUPAILZGameModel.h" @interface YOUPAILZUploadGameImageView() @property (nonatomic, weak) UIImageView *youpaipgameImgV; @property (nonatomic,strong)YOUPAILZGameModel *youpaipgameModel; @end @implementation YOUPAILZUploadGameImageView - (instancetype)initWithModel:(YOUPAILZGameModel *)gameModel{ if (self = [super init]) { self.youpaipgameModel = gameModel; [self youpaifsetupUI]; } return self; } - (void)youpaifsetupUI{ UIScrollView *scrollView = [[UIScrollView alloc] init]; scrollView.showsVerticalScrollIndicator = NO; scrollView.showsHorizontalScrollIndicator = NO; [self addSubview:scrollView]; [scrollView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.right.bottom.offset(0.0f); }]; UILabel *skillL = [[UILabel alloc] init]; skillL.font = LCFont17; skillL.textColor = HexColorFromRGB(0x333333); skillL.text = @"上传技能图"; [scrollView addSubview:skillL]; [skillL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(16.0f); make.top.offset(25.0f); }]; UILabel *skillDescL = [[UILabel alloc] init]; skillDescL.font = LCFont12; skillDescL.textColor = HexColorFromRGB(0x999999); skillDescL.text = @"(禁止盗用他人图片,发现将会封号)"; [scrollView addSubview:skillDescL]; [skillDescL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(16.0f); make.top.equalTo(skillL.mas_bottom).offset(5.0f); }]; UIImageView *gameImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_game_info_bordor"]]; gameImgV.layer.cornerRadius = 4.0f; gameImgV.clipsToBounds = YES; gameImgV.userInteractionEnabled = YES; UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(youpaifgameImgVClick)]; [gameImgV addGestureRecognizer:tap]; [scrollView addSubview:gameImgV]; self.youpaipgameImgV = gameImgV; [gameImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(ScaleSize(16.0f)); make.width.offset(KScreenWidth - ScaleSize(32.0f)); make.top.equalTo(skillDescL.mas_bottom).offset(19.0f); make.height.offset(ScaleSize(193.0f)); }]; UIImageView *cameraImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_game_camera"]]; [gameImgV addSubview:cameraImgV]; [cameraImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.offset(ScaleSize(51.0f)); make.centerX.equalTo(gameImgV.mas_centerX); make.size.mas_offset(CGSizeMake(ScaleSize(44.0f), ScaleSize(44.0f))); }]; UILabel *descL = [[UILabel alloc] init]; descL.font = LCFont14; descL.textColor = HexColorFromRGB(0x999999); descL.text = @"清晰显示游戏界面包含最新赛季游戏id和段位的完整截图(资质要求新赛季:铂金及以上)"; descL.numberOfLines = 0; descL.textAlignment = NSTextAlignmentCenter; [gameImgV addSubview:descL]; [descL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(ScaleSize(20.0f)); make.right.offset(-ScaleSize(20.0f)); make.top.equalTo(cameraImgV.mas_bottom).offset(ScaleSize(15.0f)); }]; UIView *line = [[UIView alloc] init]; line.backgroundColor = HexColorFromRGB(0xF6F6F6); [scrollView addSubview:line]; [line mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(0.0f); make.top.equalTo(self.youpaipgameImgV.mas_bottom).offset(15.0f); make.height.offset(5.0f); make.width.offset(KScreenWidth); }]; UILabel *exampleL = [[UILabel alloc] init]; exampleL.font = LCFont17; exampleL.textColor = HexColorFromRGB(0x333333); exampleL.text = @"示例图片"; [scrollView addSubview:exampleL]; [exampleL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(16.0f); make.top.equalTo(line.mas_bottom).offset(16.0f); }]; UILabel *exampleDescL = [[UILabel alloc] init]; exampleDescL.font = LCFont12; exampleDescL.textColor = HexColorFromRGB(0x999999); exampleDescL.text = @"(清晰显示完整截图,如示例图样式)"; [scrollView addSubview:exampleDescL]; [exampleDescL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(16.0f); make.top.equalTo(exampleL.mas_bottom).offset(5.0f); }]; UIImageView *exampleImgV = [[UIImageView alloc] init]; [exampleImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipgameModel.youpaipexample_img]]; exampleImgV.layer.cornerRadius = 4.0f; exampleImgV.clipsToBounds = YES; [scrollView addSubview:exampleImgV]; [exampleImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(ScaleSize(16.0f)); make.width.offset(KScreenWidth - ScaleSize(32.0f)); make.top.equalTo(exampleDescL.mas_bottom).offset(19.0f); make.height.offset(ScaleSize(193.0f)); }]; [scrollView layoutIfNeeded]; scrollView.contentSize = CGSizeMake(KScreenWidth, exampleImgV.mj_h + exampleImgV.mj_y + 56.0f); } - (void)youpaifgameImgVClick{ TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 columnNumber:4 delegate:nil]; [LCTZImageConfigHelper setDefaultTZImageConfig:imagePickerVc]; imagePickerVc.allowTakePicture = YES; // 在内部显示拍照按钮 imagePickerVc.allowPickingVideo = NO;//是否允许选择视频 imagePickerVc.allowPickingImage = YES;//是否允许选择照片 imagePickerVc.allowPickingOriginalPhoto = YES;//是否选择原图 imagePickerVc.showSelectedIndex = YES; //显示图片序号 // 4. 照片排列按修改时间升序 imagePickerVc.sortAscendingByModificationDate = YES;//按时间倒序排列图片 // 你可以通过block或者代理,来得到用户选择的照片. [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { if (photos.count != 0) { self.youpaipgameImgV.image = photos[0]; self.youpaipgameModel.youpaipselectedImage = self.youpaipgameImgV.image; for (UIView *view in self.youpaipgameImgV.subviews) { [view removeFromSuperview]; } } }]; [[LCTools getCurrentVC] presentViewController:imagePickerVc animated:YES completion:nil]; } @end