Since your cells may be recycled/reused before the image request has a chance to succeed or fail (via scrolling, for example), you can end up with an "orphaned" activity indicator in a cell.
Sequence of events:
- A cell loads, attempts to load the image and starts the activity indicator
- The user scrolls before the image loads. The cell is recycled.
- The cell is reused. A new activity indicator is added, and the previous image loading is aborted (so the previous success/failure blocks are never called). The old and new activity indicators are now both on the cell, with the old one still running.
Some suggestions to avoid this problem:
- Create a custom cell that includes the activity indicator.
- When creating the activity indicator assign a number to the indicator's tag property, then lookup to see if there's already an activity indicator via viewWithTag: when reusing a cell. If it already exists, use the existing one, otherwise, create a new one.