美文网首页
1.UICollectionView参数的理解

1.UICollectionView参数的理解

作者: bytebytebyte | 来源:发表于2016-08-16 21:35 被阅读0次

    ```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;

    }

    ```

    相关文章

      网友评论

          本文标题:1.UICollectionView参数的理解

          本文链接:https://www.haomeiwen.com/subject/wdopsttx.html