当刷新控件显示时,sectionHeadersPinToVisibleBounds错误地粘贴

时间:2017-01-03 18:58:35

标签: ios swift uicollectionview uicollectionviewlayout

这些图像来自集合视图。除非正在刷新集合视图,否则节标题将完美地粘在顶部。在这种情况下,部分标题会像刷新控件一样向下按下。

这是创建CollectionView的代码

let layout = UICollectionViewFlowLayout()
    layout.minimumLineSpacing = 0
    layout.minimumInteritemSpacing = 0
    layout.scrollDirection = .vertical
    layout.sectionHeadersPinToVisibleBounds = true

    let screenSize: CGRect = UIScreen.main.bounds
    let frame = CGRect(x: 0, y: 0, width: screenSize.width, height: screenSize.height)
    collectionView?.contentInset = UIEdgeInsetsMake(0, 0, 0, 0)
    collectionView?.frame = frame
    collectionView?.setCollectionViewLayout(layout, animated: true)
    collectionView?.alwaysBounceVertical = true
    collectionView?.delegate = self
    collectionView?.dataSource = self

First image

Second after scrolling down

0 个答案:

没有答案