How to Replace an Image in Xcode

I’ve been playing with a lot of graphics in Xcode over the last few weeks and had a lot of trouble replacing images when not changing the file name. It can be pretty frustrating, for example, when resizing images to have Xcode refuse to show the new size.¬†For some reason it keeps the old version of the image no matter how many times I delete and re-add it, or clean and rebuild the project.

I hit on the following sequence that works every time to replace images:

  1. Delete the original image version from within Xcode. Trash it. (Make sure you have the new version of your image available outside the project area first, of course…)
  2. Clean the project.
  3. Quit Xcode completely and restart.
  4. Copy the new file with the same name back into the project area.
  5. Re-add the file.

It might not be quick, but it’s worked every time for me so far. Given that other strategies for clearing things involve digging through files to find the project installation on the simulator to delete (and I can never remember where that is), this at least seems fairly simple and straight forward.

Hope it helps.