0

I am new to iOS development and I am stocked with a bug in my app. I have this News Like/InShorts app where I have used collection view. One news feed takes up the entire screen space. Assume I have a video and a description text for every news feed. Now what happens is when I partial scroll from collection view cell [0,1] to [0,2] I don't release my finger and I come back to [0,1]. Now as soon as the collection view cell is partially scrolled to the second cell, CellForItemAt is called for next second cell and the video URL of the second cell is binded to the object but I didn't scroll to the second cell yet. So when I click onto the play button in cell one, it loads the video which was a part of the second cell. So my question is, how to avoid this behavior of cellForItemAt being called on a partial scroll?

PS: I am not prefetching Data.

Jarvis The Avenger
  • 2,750
  • 1
  • 19
  • 37
  • 1
    You would need to provide more details about the video for a clearer explanation about it, put all related code in your question please. – Gustavo Vollbrecht Jan 30 '19 at 12:25
  • You can't avoid the CellForItemAt call. But you can use the [UIScrollViewDelegate](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate) protocol to follow up the scrolling activity. Also, check [this](https://stackoverflow.com/questions/9831485/best-way-to-check-if-uitableviewcell-is-completely-visible) question. – Luciano Sclovsky Jan 30 '19 at 12:42
  • This sounds more like an issue of how you're managing the playing of the appropriate URL rather than a cellForItem issue. You should post your code and change the problem title accordingly. – Frankie Jan 30 '19 at 12:49

0 Answers0