No, it is printing null, it is returning nil. So your test will be:
Code:
if ([dictionary objectForKey:theKey] == nil)
That was what I was missing, I was under the assumption that when looking for a key in a plist, if it returned nil then nothing would be done and if it returned a value, then it would act upon that.
I have now added the if statement to do just that. I never did understand getting information from plists very much but now I know a little more and will pass on what I know.
Thank you everyone for your help...here is what I ended up with
You want to return a cell in all cases, so leave return cell at the end of the method.
This cell could be brand new or dequeued (re-used), so your if statement should also be dealing with cases where an existing image needs to be removed.
It's also not clear to me how [dictionary objectForKey:@"imageKey"] isn't returning the same value for every cell, unless the value of dictionary is changing each time?
It's also not clear to me how [dictionary objectForKey:@"imageKey"] isn't returning the same value for every cell, unless the value of dictionary is changing each time?
With a long enough list, that still won't work. You need to clear out the image view.
Also, I get everything working as intended. Those cells that would have an image according to the imageKey show the proper image, and those that dont show nothing. Even for parts of my table that are over 75 items long. Now I am not saying that is a long list, because this is the first time that I have gotten things to work the way I want them to. So do I really need to clear the image?
Also, I have run it through instruments and I am not getting any memory leaks, as far as I can tell.
It's not a matter of leaks, it's a matter of cell recycling. You aren't (or shouldn't be) dealing with a brand new cell every time. The cell you have could be a cell that already has an image from a previous row. You look for the key, and if it isn't there just return the cell. So the old image should be there. It's dumb luck if you arent seeing that happen already, or you don't have very many non-image rows.