12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- //
- // GoodsReviewsImgV.m
- // westkissMob
- //
- // Created by 王猛 on 2022/9/29.
- //
- #import "GoodsReviewsImgV.h"
- @implementation GoodsReviewsImgV
- - (void)tt_setupViews{
- self.xxx_subImgAry = [[NSMutableArray alloc]init];
- for (int i= 0; i<3; i++) {
- UIImageView *tempImg = [[UIImageView alloc]init];
- tempImg.userInteractionEnabled = YES;
- tempImg.image = UIImageDefaultImg_SD;
- tempImg.tag = GoodsReviewsCellImgsTag+i;
- tempImg.contentMode = UIViewContentModeScaleAspectFill;
- tempImg.clipsToBounds = YES;
- [self addSubview:tempImg];
- UITapGestureRecognizer *imgTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tap_imgFull:)];
- [tempImg addGestureRecognizer:imgTap];
- tempImg.hidden = YES;
- tempImg.frame = CGRectMake(10+(GoodsReviewsimgWidth+10)*i, 10, GoodsReviewsimgWidth, GoodsReviewsimgWidth);
- [tempImg mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10+(GoodsReviewsimgWidth+10)*i);
- make.top.mas_equalTo(10);
- make.height.mas_equalTo(GoodsReviewsimgWidth);
- make.width.mas_equalTo(GoodsReviewsimgWidth);
- }];
- [self.xxx_subImgAry addObject:tempImg];
- UIImageView *fullImg = [[UIImageView alloc] initWithImage:IMAGE(@"goods_reviews_fullscreen")];
- fullImg.userInteractionEnabled = YES;
- fullImg.contentMode = UIViewContentModeCenter;
- [tempImg addSubview:fullImg];
- fullImg.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.4];
- fullImg.frame = CGRectMake(GoodsReviewsimgWidth-26, GoodsReviewsimgWidth-26, 26, 26);
- [fullImg mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(@0);
- make.bottom.mas_equalTo(0);
- make.width.mas_equalTo(26);
- make.height.mas_equalTo(26);
- }];
-
- }
- }
- -(void)tap_imgFull:(UITapGestureRecognizer *)tap{
- [self generaltriggermethodType:tap.view.tag-GoodsReviewsCellImgsTag data:self.imgDataAry];
- }
- - (void)tt_confignewdata:(id)data{
- for (UIImageView *imgV in self.xxx_subImgAry) {
- imgV.hidden = YES;
- }
- NSArray *urlAry = (NSArray * )data;
- self.imgDataAry = [NSMutableArray arrayWithArray:urlAry];
- for (int i = 0; i<urlAry.count; i++) {
- UIImageView *tepImg = [self viewWithTag:GoodsReviewsCellImgsTag+i];
- tepImg.hidden = NO;
- [tepImg sd_setImageWithURL:[NSURL URLWithString:((NSString *)urlAry[i]).urlEncode] placeholderImage:UIImageDefaultImg_SD];
- }
- }
- @end
|