// // DRImageContainerView.m // YouHuiProject // // Created by 小花 on 2018/12/28. // Copyright © 2018年 kuxuan. All rights reserved. // #import "DRImageContainerView.h" #import "DRContainerImageCell.h" #import "SDPhotoBrowser.h" @interface DRImageContainerView () < UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UIScrollViewDelegate, SDPhotoBrowserDelegate > @property (nonatomic, strong) UICollectionView *collectionView; @property (nonatomic, strong) UIScrollView *scrollView; @property (nonatomic, strong) NSArray *dataArr; @property (nonatomic, strong) NSMutableArray *imgViewArray; @end static NSString *cellID = @"cellID"; @implementation DRImageContainerView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self initSubViews]; } return self; } - (void)initSubViews { // UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init]; // flowLayout.minimumLineSpacing = 5; // flowLayout.minimumInteritemSpacing = 5; // flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal; // self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 5, SCREEN_WIDTH, 150) collectionViewLayout:flowLayout]; // self.collectionView.delegate = self; // self.collectionView.dataSource = self; // self.collectionView.backgroundColor = [UIColor YHColorWithHex:0xFDF8F1]; // self.collectionView.showsVerticalScrollIndicator = NO; // self.collectionView.showsHorizontalScrollIndicator = NO; // [self.collectionView registerClass:[DRContainerImageCell class] forCellWithReuseIdentifier:cellID]; // [self addSubview:self.collectionView]; self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 150)]; [self addSubview:self.scrollView]; } - (void)reloadWithDataArray:(NSArray *)dataArr { self.dataArr = dataArr; CGFloat width = 147; [self.scrollView removeAllSubviews]; [self.imgViewArray removeAllObjects]; UIImageView *lastImgView; for (int i = 0; i