@david.brotton Fantastic details that really helped me dig in here.
So I’m 90% sure I see what is happening and it has to do with how table cells are “reused” internally in the UITableView framework on the iOS side…
So tableview cells are reused when they leave the screen. What, Wade? What I mean is that when you scroll through a table, the top cells that leave the screen’s view are not actually fully removed from memory and the new cells that appear are not necessarily always created from scratch… when they can, they are actually reused. This is has everything to do with memory management in an effort to create the best UX (which contradicts what you’re seeing, I know)
What’s happening here, and why this issue appears semi-random, is when the new cells are being created at the bottom, that top cell has left the screen BUT has been placed into the table’s “reuse pile”. The logic you have is perfectly sound EXCEPT for a little housekeeping that no one would expect you to naturally know to do and I could make an argument that in a no-code platform like Dropsource, we should make the judgement call to step in and perform this for you. The opposing view would be that we would be fighting against best practice memory management in other contexts. I’ll bring this up to our engineering department and try to spur a discussion around where we should step in so thank you for bringing this up.
So what I want you to do here is in your Cell Loaded event here, I want you to reset that cell’s imageview image property manually to the “Your Coupon Here” image just before before that 1st if/else statement. What you’re doing is adding a manual “reset that image to the default” step because the phone itself isn’t doing that since the cells are technically being reused.
Please let me know if that doesn’t solve the issue but I believe it should. You’re essentially manually reseting the cell and sometimes the step is redundant because you’re immediately going to change it again to a coupon image if 1 is available in the API response BUT this extra step will begin each cell, reused or not, with the default image and I believe that’s what you’re expecting to occur… and rightfully so in my opinion.