2017-09-06 7 views
3

collectionViewの中の特定のindexPathを選択してスクロールしたいと思います。私はその機能を発見しましたが、それらを組み合わせることは不可能です:iOS: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) 

ありがとうございます。

答えて

3

あなたはオプションが[.centeredHorizontally,.centeredVertically]

collectionView.scrollToItem(at: indexPath, at: [.centeredHorizontally,.centeredVertically], animated: true) 
+0

パーフェクトを設定渡すことができます、どうもありがとうございました。 – Claudio

関連する問題