Animation Duration for UICollectionView selectItemAtIndexPath:animated:scrollPosition:

I had similar problems with UITableView which I solved by the following code:

[CATransaction begin];
[CATransaction setCompletionBlock:onCompletion];
[CATransaction setAnimationDuration:duration];

[self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:3 inSection:3]
                            atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally
                                    animated:YES];

[CATransaction commit];

Obviously, you can’t call it with animated:NO because the animation code inside the method is important. Using a CATransaction to wrap the animation worked for me.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)