admin管理员组文章数量:1314349
I am using a diffable datasource with a compositional layout. My CollectionView has expandable cells. When I try to update the cell's expanded state using applySnapshot with animation, the CollectionView changes its scroll position. However, when I do this without animation, everything works fine, and the scroll position does not change when the cell height is updated. How can I do this with animation? It is my section layout configuration:
private func makeSectionlayout(environment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection {
let itemWidth = view.frame.width - Constants.Layout.sectionInsets.horizontal
let itemSize = NSCollectionLayoutSize(widthDimension: .absolute(itemWidth),
heightDimension: .estimated(400))
let item = NSCollectionLayoutItem(layoutSize: itemSize)
let groupWidth = environment.container.contentSize.width - Constants.Layout.sectionInsets.horizontal
let groupSize = NSCollectionLayoutSize(widthDimension: .absolute(groupWidth),
heightDimension: .estimated(400))
let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitems: [item])
group.interItemSpacing = .fixed(16)
let section = NSCollectionLayoutSection(group: group)
section.contentInsets = Constants.Layout.sectionInsets
section.interGroupSpacing = 16
return section
}
本文标签: iosCollectionView change scroll position when cell expanding using diffable datasourceStack Overflow
版权声明:本文标题:ios - CollectionView change scroll position when cell expanding using diffable datasource - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741877568a2402554.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论