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

Scroll like animation on the click of Button #30

Open
madBureaToT opened this issue Aug 9, 2017 · 5 comments
Open

Scroll like animation on the click of Button #30

madBureaToT opened this issue Aug 9, 2017 · 5 comments

Comments

@madBureaToT
Copy link

hey! well this works well while we have UICollectionViewCtr when we try to Customize it to ViewController By just setting flowLayout of CollectionView.

Now i have left and right button and i want the same Procedure of scroll animation on the click of these two button Action.

if any one have performed this then please help.

@nohraay
Copy link

nohraay commented Aug 19, 2017

var nextPage:Int = 0

@objc func clickFn(sender:UIButton){
print(nextPage)
print(vcs.count)

    if(nextPage == (vcs.count-1)){
        return
    }
    nextPage += 1
    let nextItem = NSIndexPath(row: nextPage, section: 0)
    collectionView?.scrollToItem(at: nextItem as IndexPath, at: .centeredHorizontally, animated: true)
}

@yonlau
Copy link

yonlau commented May 18, 2020

ScrollToItem didn't work. Any one can help?

@updev0612
Copy link

me too. is there any update?

@updev0612
Copy link

please diable pagination property

@soring323
Copy link

solution is simple.
collectionView.collectionViewLayout.invalidateLayout()
collectionView.scrollToItem(at: index, at: .centeredHorizontally, animated: false)
This is working well.

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

5 participants