Мы попытались свернуть UICollectionView
как список по карте. Это не следует путать с нижним листом, который привязывается к точке (например, к нижней, средней и высокой). Свойство flowlayout представления коллекции имеет sectionHeadersPinToVisibleBounds
включенное значение. Я приложил образец проекта для справки. Есть ли способ, которым представление заголовка может перемещаться в верхнюю часть представления коллекции при прокрутке пользователя?
Вот пример проекта
Существенные изменения нужны мне, чтобы войти в это состояние:
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)
}
Вот скриншот того, что вы увидите:
Красный цвет — это вид заголовка, который закреплен. Нужен ли мне пользовательский макет для обновления его положения при прокрутке пользователем?