We tried to roll the UICollectionView
like a list over the map. This is not to be confused with bottom sheet which snaps to a point (like low, mid and high). The collectionview's flowlayout property has sectionHeadersPinToVisibleBounds
enabled. I have attached the sample project for your reference. Is there any way the header view can move to the top of the collectionview as the user scrolls?
Here is the sample project
Essential changes need for me to enter that state:
let layout = UICollectionViewFlowLayout()
layout.sectionHeadersPinToVisibleBounds = true
layout.minimumLineSpacing = 0
layout.minimumInteritemSpacing = 0
let collectionView = UICollectionView(frame: .zero,
collectionViewLayout: layout)
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
collectionView.contentInset = UIEdgeInsets(top: drawerHeight, left: 0, bottom: 0, right: 0)
}
Here is a screenshot of what you would see:
Red colored view is the header view which is pinned. Do I need a custom layout to update its position as the user scrolls?