views:

11

answers:

1

Hi,

I'm having a weird problem using [UIImage imageNamed:] method to set table view cells' backgrounds.

I typically do this for a cell:

backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"cell_background.png"]];

For some unknown reason, the image returned is not "cell_background.png". It actually returns an older version of the image which has a different name now ("button_background.png"). The image preview for cell_background in XCode shows the right image, and "open" or "reveal in finder" also are ok. I tried to remove all images from the project and put them back, but the problem remains.

What could cause imageNamed: to load an older version of the image or an image with another name?

+1  A: 

Clean up all targets. Rebuild the project. Make sure the image name is correct. Check for upper-case lower-case as well, in iPhone Hello.png != hello.png

Wintorez
Name was correct, so I simply cleaned up all targets, and now everything's fine. I should have thought about this! Thanks
Jukurrpa