这些图像来自集合视图。除非正在刷新集合视图,否则节标题将完美地粘在顶部。在这种情况下,部分标题会像刷新控件一样向下按下。
这是创建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