@interface AlbumDetailCollectionVC : UICollectionViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self.collectionView registerNib:[UINib nibWithNibName:@"AlbumDetailCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:reuseIdentifier];
}
- (instancetype)init
{
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
// cell的大小
int cols = 3;
CGFloat inset = 2;
CGFloat width = (kScreenWidth-4*inset)/cols;
layout.itemSize = CGSizeMake(width,width);
layout.sectionInset = UIEdgeInsetsMake(inset, inset, inset, inset);
// 设置每一行之间的间距
layout.minimumLineSpacing = inset;
//同一行相邻两个cell的最小间距
layout.minimumInteritemSpacing = inset;
return [self initWithCollectionViewLayout:layout];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
//return self.model.data.count;
return self.photoModelArr.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
AlbumDetailCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
}