Som Som - 6 months ago 24
iOS Question

Avoid animation while scrollToItemAtIndexPath

I need a collectionView to scroll to selected index without animation. While in method i am using animated as NO. It is taking animation after passing NO into it. Please help me if anyone has an idea about it.

[self.firstCollPView scrollToItemAtIndexPath:selIndexPath atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:NO];

Answer

Once try to perform this on main thread if it can solve issue! Something like,

 dispatch_async(dispatch_get_main_queue(), ^{

    [self.firstCollPView scrollToItemAtIndexPath:selIndexPath atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:NO];

});
Comments