AnimatedCollectionViewLayout
AnimatedCollectionViewLayout copied to clipboard
Scroll like animation on the click of Button
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.
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)
}
ScrollToItem didn't work. Any one can help?
me too. is there any update?
please diable pagination property
solution is simple. collectionView.collectionViewLayout.invalidateLayout() collectionView.scrollToItem(at: index, at: .centeredHorizontally, animated: false) This is working well.