1

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:

  • Use UITableView, with each row to have 4 different elements.
  • Use UIScrollView, and preload all elements there. We used to use KKGridView library here, but it is way outdated. That is why we move to UICollectionView after 6-7 years

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

12
  • you could disable reload while scrolling, e.g. stackoverflow.com/a/993304/22147 Commented May 18, 2017 at 5:02
  • that wouldn't help, I don't have problems with scrolling Commented May 18, 2017 at 5:03
  • whoops, sorry, missed that. you could reload the cell yourself without asking the collection view to do it Commented May 18, 2017 at 5:04
  • why dont just update the cell's view instead of reload whole visible cell? Commented May 18, 2017 at 5:09
  • Perhaps you could show some code as it isn't exactly clear what you are reloading; reloading the entire collection view isn't a good idea. Commented May 18, 2017 at 5:25

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.