vodkhang
vodkhang

Reputation: 18741

UICollectionView reload every second

My sport app keeps track of who is on and off the field, and for how long. I normally have 20-30 people to swap around, during training time. I have a timer to reload the visible cells of the collection view every second. The whole collection view reload can cost between 120-150ms.

The scrolling performance is good, however, sometimes the tapping to swap players does not respond. I think that is when the collection view is trying to reload the cells.

I can see there might a couple of ways:

Have anyone had the same issue, and which way should provide the acceptable level of efficiency but not too complex to implement (to reduce the number of bugs)

CollectionView

Upvotes: 1

Views: 447

Answers (1)

Tj3n
Tj3n

Reputation: 9943

Keep the record of the cell's index that need to update, then get the Cell from collection view, call method ask it to update itself, push the view update to the cell class, it wont mess with your collection view tap/drag...

Reload whole collectionView is only needed when whole dataSource change, yours is simply cell-by-cell update as I notice

Upvotes: 1

Related Questions