GoodsReviewsImgV.m 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // GoodsReviewsImgV.m
  3. // westkissMob
  4. //
  5. // Created by 王猛 on 2022/9/29.
  6. //
  7. #import "GoodsReviewsImgV.h"
  8. @implementation GoodsReviewsImgV
  9. - (void)tt_setupViews{
  10. self.xxx_subImgAry = [[NSMutableArray alloc]init];
  11. for (int i= 0; i<3; i++) {
  12. UIImageView *tempImg = [[UIImageView alloc]init];
  13. tempImg.userInteractionEnabled = YES;
  14. tempImg.image = UIImageDefaultImg_SD;
  15. tempImg.tag = GoodsReviewsCellImgsTag+i;
  16. tempImg.contentMode = UIViewContentModeScaleAspectFill;
  17. tempImg.clipsToBounds = YES;
  18. [self addSubview:tempImg];
  19. UITapGestureRecognizer *imgTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tap_imgFull:)];
  20. [tempImg addGestureRecognizer:imgTap];
  21. tempImg.hidden = YES;
  22. tempImg.frame = CGRectMake(10+(GoodsReviewsimgWidth+10)*i, 10, GoodsReviewsimgWidth, GoodsReviewsimgWidth);
  23. [tempImg mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.left.mas_equalTo(10+(GoodsReviewsimgWidth+10)*i);
  25. make.top.mas_equalTo(10);
  26. make.height.mas_equalTo(GoodsReviewsimgWidth);
  27. make.width.mas_equalTo(GoodsReviewsimgWidth);
  28. }];
  29. [self.xxx_subImgAry addObject:tempImg];
  30. UIImageView *fullImg = [[UIImageView alloc] initWithImage:IMAGE(@"goods_reviews_fullscreen")];
  31. fullImg.userInteractionEnabled = YES;
  32. fullImg.contentMode = UIViewContentModeCenter;
  33. [tempImg addSubview:fullImg];
  34. fullImg.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.4];
  35. fullImg.frame = CGRectMake(GoodsReviewsimgWidth-26, GoodsReviewsimgWidth-26, 26, 26);
  36. [fullImg mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.right.equalTo(@0);
  38. make.bottom.mas_equalTo(0);
  39. make.width.mas_equalTo(26);
  40. make.height.mas_equalTo(26);
  41. }];
  42. }
  43. }
  44. -(void)tap_imgFull:(UITapGestureRecognizer *)tap{
  45. [self generaltriggermethodType:tap.view.tag-GoodsReviewsCellImgsTag data:self.imgDataAry];
  46. }
  47. - (void)tt_confignewdata:(id)data{
  48. for (UIImageView *imgV in self.xxx_subImgAry) {
  49. imgV.hidden = YES;
  50. }
  51. NSArray *urlAry = (NSArray * )data;
  52. self.imgDataAry = [NSMutableArray arrayWithArray:urlAry];
  53. for (int i = 0; i<urlAry.count; i++) {
  54. UIImageView *tepImg = [self viewWithTag:GoodsReviewsCellImgsTag+i];
  55. tepImg.hidden = NO;
  56. [tepImg sd_setImageWithURL:[NSURL URLWithString:((NSString *)urlAry[i]).urlEncode] placeholderImage:UIImageDefaultImg_SD];
  57. }
  58. }
  59. @end