Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I disable automatic selection? #107

Closed
beom-mingyu opened this issue Nov 9, 2020 · 3 comments
Closed

How can I disable automatic selection? #107

beom-mingyu opened this issue Nov 9, 2020 · 3 comments

Comments

@beom-mingyu
Copy link

...
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?

@itsmeichigo
Copy link
Owner

Hi, currently there's no option to disable the selection so if you need custom behaviors you can fork the library and update it to your needs.

@beom-mingyu
Copy link
Author

beom-mingyu commented Nov 9, 2020

ok, thank u

@palla89
Copy link

palla89 commented Dec 16, 2021

done in pull request #112 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants