You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...
private func alignCollectionView(_ collectionView: UICollectionView) {
let centerPoint = CGPoint(x: collectionView.center.x + collectionView.contentOffset.x, y: 50);
if let indexPath = collectionView.indexPathForItem(at: centerPoint) {
// automatically select this item and center it to the screen <<----Not to be selected!
// set animated = false to avoid unwanted effects
collectionView.selectItem(at: indexPath, animated: false, scrollPosition: .top)
if let cell = collectionView.cellForItem(at: indexPath) {
let offset = CGPoint(x: cell.center.x - collectionView.frame.width / 2, y: 0)
collectionView.setContentOffset(offset, animated: false)
}
...
How can I disable automatic selection?
The text was updated successfully, but these errors were encountered:
...
private func alignCollectionView(_ collectionView: UICollectionView) {
let centerPoint = CGPoint(x: collectionView.center.x + collectionView.contentOffset.x, y: 50);
if let indexPath = collectionView.indexPathForItem(at: centerPoint) {
// automatically select this item and center it to the screen <<----Not to be selected!
// set animated = false to avoid unwanted effects
collectionView.selectItem(at: indexPath, animated: false, scrollPosition: .top)
if let cell = collectionView.cellForItem(at: indexPath) {
let offset = CGPoint(x: cell.center.x - collectionView.frame.width / 2, y: 0)
collectionView.setContentOffset(offset, animated: false)
}
...
How can I disable automatic selection?
The text was updated successfully, but these errors were encountered: