Is there any way to change something about a table cell on the iPhone based on the previous or next table cell before that cell is displayed? This might be confusing, so here’s an example:
Let’s say I have a table like this (I’m just going to fill it with random values, so don’t worry about the text contained in the cells):
*Cat
*Rabbit
*Dog
*Mouse
and there was a imageView.image attached to some cells (different images for different animals and you don’t know which ones might have images) and at some point (programmatically) new animals are entered into the list sandwiching the animals that are already entered like so:
*[animal]
*Cat
*[animal]
*Rabbit
*[animal]
*Dog
*[animal]
*Mouse
*[animal]
How would I go about moving the images associated with the previously listed animals?
Hopefully you get a kick out of how ridiculous this question sounds, but I swear it is a serious question that is driving me insane and I didn’t know how else to describe it.
Felixs’ answer probably works, but it sounds like you are thinking of it from view-manipulation angle, and not a model-manipulation angle. It sounds like you really have two parallel models: the list of animals and the set of images. Why not just
reloadDatawhen either thing changes and rebuild the cells appropriately from inside your controller?Reaching into existing cells based on their index feels fragile to me.