Ωlo*_*stA 4 ios uicollectionview uicollectionviewcell swift swift3
我想选择并滚动到一个特定indexPath的collectionView中心.我找到了这些功能,但不可能将它们组合起来:
collectionView.selectItem(at: indexPath, animated: true, scrollPosition: UICollectionViewScrollPosition.centeredVertically)
collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true)
collectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: true)
Run Code Online (Sandbox Code Playgroud)
提前致谢.
您可以传递选项集 [.centeredHorizontally,.centeredVertically]
collectionView.scrollToItem(at: indexPath, at: [.centeredHorizontally,.centeredVertically], animated: true)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1716 次 |
| 最近记录: |