美文网首页
sectionHeader悬浮

sectionHeader悬浮

作者: 一米阳光k1992 | 来源:发表于2018-09-25 19:29 被阅读0次

    设置collectionView sectionHeader 悬浮  (针对MVVM)

    viewMode中设置多个sectionArray  并且为每个section 设置header

    将sectionArray添加进 dataArray中 并返回dataArray

    VC中设置layout

    //section header 悬浮自定义layout

    - (UICollectionViewLayout*)collectionViewLayout {

        UICollectionViewLayout * layout = self.collectionView.collectionViewLayout;

        if(!layout) {

            UICollectionViewFlowLayout * flowLayout = [[UICollectionViewFlowLayout alloc] init];

            flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;

            flowLayout.minimumLineSpacing=10;

            flowLayout.minimumInteritemSpacing = 0;

            flowLayout.sectionInset = UIEdgeInsetsZero;

            flowLayout.headerReferenceSize = CGSizeZero;

            flowLayout.footerReferenceSize = CGSizeZero;

            if(IOS_9_OR_LATER()){

                flowLayout.sectionHeadersPinToVisibleBounds = YES;

            }

            layout = flowLayout;

        }

        returnlayout;

    }

    相关文章

      网友评论

          本文标题:sectionHeader悬浮

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