```javascript
-(UICollectionView *)userImageCollectionView
{
if (_userImageCollectionView == nil) {
UICollectionViewFlowLayout *flowLay = [[UICollectionViewFlowLayout alloc]init];
//每个cell的大小 40 60
flowLay.itemSize = CGSizeMake(CGRectGetHeight(_tripCollectionView.frame) - 10 - 20 , CGRectGetHeight(_tripCollectionView.frame) - 10);
//每个section距collectionView的边界或者section上左下右的苦力
flowLay.sectionInset = UIEdgeInsetsMake(5, 10, 5, 10);
//cell之间的最小距离
flowLay.minimumInteritemSpacing = 10;
//每行cell之间的最小距离
flowLay.minimumLineSpacing = 10;
flowLay.scrollDirection = UICollectionViewScrollDirectionVertical;
_userImageCollectionView = [[UICollectionView alloc]initWithFrame:(CGRectMake(CGRectGetMinX(_tripCollectionView.frame), CGRectGetMaxY(_tripCollectionView.frame), CGRectGetWidth(_tripCollectionView.frame), CGRectGetHeight(_tripCollectionView.frame) * 2)) collectionViewLayout:flowLay];
_userImageCollectionView.layer.cornerRadius = 5;
_userImageCollectionView.layer.masksToBounds = YES;
_userImageCollectionView.bounces = NO;
_userImageCollectionView.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.5];;
[self.mapView addSubview:_userImageCollectionView];
_userImageCollectionView.hidden = YES;
}
return _userImageCollectionView;
}
```
网友评论