Post

Replies

Boosts

Views

Activity

Reply to iOS 14 UICollectionView scrollToItem not working
The problem with calling scrollToItemAtIndexPath: during viewDidAppear: is that the collection renders, and then it redraws itself. This happens very quickly. But it basically flashes the visible cells, then scrolls to the desired position. I can't put this code into viewWillAppear because layout hasn't occurred yet. I did end up taking this advice. But to get around the flashing, I set the alpha value of the collectionView to 0 in viewDidLoad, then in viewDidAppear I set alpha to 1. I'm not really happy with this solution, but anything else I've tried hasn't worked. I wish I had a better approach to this.
Nov ’20