1

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?

Jukurrpa
  • 4,038
  • 7
  • 43
  • 73

1 Answers1

3

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

Reza Sadr
  • 273
  • 1
  • 5
  • Name was correct, so I simply cleaned up all targets, and now everything's fine. I should have thought about this! Thanks – Jukurrpa Sep 22 '10 at 12:26