Viewcells with images

Hi

I have a normal table, in my table I have a label and also an image. The image is optional and I’m finding once I’ve added in some people and images that as I scroll through the table on random cells an image from a different cells is shown. I’ll click the cell and it takes me to a detail page about that person and there’s no image associated with that object. I’m assuming this isn’t normal, I get that cells are refreshed, but not sure how to stop that occurring??

The table view reuses cells that have scrolled off-screen. In your cellForRowAtIndexPath method, you need to be sure and set all the items in your table view cell. If you don’t have an image, just set the image view to nil. Otherwise, it will keep the image from the last time that cell was used.

Have fun!