YOUPAILZUploadGameImageView.m 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. //
  2. // YOUPAILZUploadGameImageView.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/4/26.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZUploadGameImageView.h"
  9. #import "YOUPAILZGameModel.h"
  10. @interface YOUPAILZUploadGameImageView()
  11. @property (nonatomic, weak) UIImageView *youpaipgameImgV;
  12. @property (nonatomic,strong)YOUPAILZGameModel *youpaipgameModel;
  13. @end
  14. @implementation YOUPAILZUploadGameImageView
  15. - (instancetype)initWithModel:(YOUPAILZGameModel *)gameModel{
  16. if (self = [super init]) {
  17. self.youpaipgameModel = gameModel;
  18. [self youpaifsetupUI];
  19. }
  20. return self;
  21. }
  22. - (void)youpaifsetupUI{
  23. UIScrollView *scrollView = [[UIScrollView alloc] init];
  24. scrollView.showsVerticalScrollIndicator = NO;
  25. scrollView.showsHorizontalScrollIndicator = NO;
  26. [self addSubview:scrollView];
  27. [scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.left.top.right.bottom.offset(0.0f);
  29. }];
  30. UILabel *skillL = [[UILabel alloc] init];
  31. skillL.font = LCFont17;
  32. skillL.textColor = HexColorFromRGB(0x333333);
  33. skillL.text = @"上传技能图";
  34. [scrollView addSubview:skillL];
  35. [skillL mas_makeConstraints:^(MASConstraintMaker *make) {
  36. make.left.offset(16.0f);
  37. make.top.offset(25.0f);
  38. }];
  39. UILabel *skillDescL = [[UILabel alloc] init];
  40. skillDescL.font = LCFont12;
  41. skillDescL.textColor = HexColorFromRGB(0x999999);
  42. skillDescL.text = @"(禁止盗用他人图片,发现将会封号)";
  43. [scrollView addSubview:skillDescL];
  44. [skillDescL mas_makeConstraints:^(MASConstraintMaker *make) {
  45. make.left.offset(16.0f);
  46. make.top.equalTo(skillL.mas_bottom).offset(5.0f);
  47. }];
  48. UIImageView *gameImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_game_info_bordor"]];
  49. gameImgV.layer.cornerRadius = 4.0f;
  50. gameImgV.clipsToBounds = YES;
  51. gameImgV.userInteractionEnabled = YES;
  52. UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(youpaifgameImgVClick)];
  53. [gameImgV addGestureRecognizer:tap];
  54. [scrollView addSubview:gameImgV];
  55. self.youpaipgameImgV = gameImgV;
  56. [gameImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.left.offset(ScaleSize(16.0f));
  58. make.width.offset(KScreenWidth - ScaleSize(32.0f));
  59. make.top.equalTo(skillDescL.mas_bottom).offset(19.0f);
  60. make.height.offset(ScaleSize(193.0f));
  61. }];
  62. UIImageView *cameraImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_game_camera"]];
  63. [gameImgV addSubview:cameraImgV];
  64. [cameraImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.top.offset(ScaleSize(51.0f));
  66. make.centerX.equalTo(gameImgV.mas_centerX);
  67. make.size.mas_offset(CGSizeMake(ScaleSize(44.0f), ScaleSize(44.0f)));
  68. }];
  69. UILabel *descL = [[UILabel alloc] init];
  70. descL.font = LCFont14;
  71. descL.textColor = HexColorFromRGB(0x999999);
  72. descL.text = @"清晰显示游戏界面包含最新赛季游戏id和段位的完整截图(资质要求新赛季:铂金及以上)";
  73. descL.numberOfLines = 0;
  74. descL.textAlignment = NSTextAlignmentCenter;
  75. [gameImgV addSubview:descL];
  76. [descL mas_makeConstraints:^(MASConstraintMaker *make) {
  77. make.left.offset(ScaleSize(20.0f));
  78. make.right.offset(-ScaleSize(20.0f));
  79. make.top.equalTo(cameraImgV.mas_bottom).offset(ScaleSize(15.0f));
  80. }];
  81. UIView *line = [[UIView alloc] init];
  82. line.backgroundColor = HexColorFromRGB(0xF6F6F6);
  83. [scrollView addSubview:line];
  84. [line mas_makeConstraints:^(MASConstraintMaker *make) {
  85. make.left.offset(0.0f);
  86. make.top.equalTo(self.youpaipgameImgV.mas_bottom).offset(15.0f);
  87. make.height.offset(5.0f);
  88. make.width.offset(KScreenWidth);
  89. }];
  90. UILabel *exampleL = [[UILabel alloc] init];
  91. exampleL.font = LCFont17;
  92. exampleL.textColor = HexColorFromRGB(0x333333);
  93. exampleL.text = @"示例图片";
  94. [scrollView addSubview:exampleL];
  95. [exampleL mas_makeConstraints:^(MASConstraintMaker *make) {
  96. make.left.offset(16.0f);
  97. make.top.equalTo(line.mas_bottom).offset(16.0f);
  98. }];
  99. UILabel *exampleDescL = [[UILabel alloc] init];
  100. exampleDescL.font = LCFont12;
  101. exampleDescL.textColor = HexColorFromRGB(0x999999);
  102. exampleDescL.text = @"(清晰显示完整截图,如示例图样式)";
  103. [scrollView addSubview:exampleDescL];
  104. [exampleDescL mas_makeConstraints:^(MASConstraintMaker *make) {
  105. make.left.offset(16.0f);
  106. make.top.equalTo(exampleL.mas_bottom).offset(5.0f);
  107. }];
  108. UIImageView *exampleImgV = [[UIImageView alloc] init];
  109. [exampleImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipgameModel.youpaipexample_img]];
  110. exampleImgV.layer.cornerRadius = 4.0f;
  111. exampleImgV.clipsToBounds = YES;
  112. [scrollView addSubview:exampleImgV];
  113. [exampleImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  114. make.left.offset(ScaleSize(16.0f));
  115. make.width.offset(KScreenWidth - ScaleSize(32.0f));
  116. make.top.equalTo(exampleDescL.mas_bottom).offset(19.0f);
  117. make.height.offset(ScaleSize(193.0f));
  118. }];
  119. [scrollView layoutIfNeeded];
  120. scrollView.contentSize = CGSizeMake(KScreenWidth, exampleImgV.mj_h + exampleImgV.mj_y + 56.0f);
  121. }
  122. - (void)youpaifgameImgVClick{
  123. TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 columnNumber:4 delegate:nil];
  124. [LCTZImageConfigHelper setDefaultTZImageConfig:imagePickerVc];
  125. imagePickerVc.allowTakePicture = YES; // 在内部显示拍照按钮
  126. imagePickerVc.allowPickingVideo = NO;//是否允许选择视频
  127. imagePickerVc.allowPickingImage = YES;//是否允许选择照片
  128. imagePickerVc.allowPickingOriginalPhoto = YES;//是否选择原图
  129. imagePickerVc.showSelectedIndex = YES; //显示图片序号
  130. // 4. 照片排列按修改时间升序
  131. imagePickerVc.sortAscendingByModificationDate = YES;//按时间倒序排列图片
  132. // 你可以通过block或者代理,来得到用户选择的照片.
  133. [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
  134. if (photos.count != 0) {
  135. self.youpaipgameImgV.image = photos[0];
  136. self.youpaipgameModel.youpaipselectedImage = self.youpaipgameImgV.image;
  137. for (UIView *view in self.youpaipgameImgV.subviews) {
  138. [view removeFromSuperview];
  139. }
  140. }
  141. }];
  142. [[LCTools getCurrentVC] presentViewController:imagePickerVc animated:YES completion:nil];
  143. }
  144. @end