Reputation: 30304
In my ios project, I have loaded an image to ImageView
by using:
[UIImage imageNamed:@"sample.png"];
This image I have in project by using: right click project, add files. And images is added to [Project Name] directory.
But I try to delete this image physically in Finder (move to trash). Clean and Build project and run again, and this image still appear on ImageView
. I really cannot explain why.
So my question is: the method [UIImage imageNamed]
where images in xcode project will be searched and loaded ? I see some projects, they put inside Image
folder and everything still load successfully. And why when I delete those image file, nothing wrong happen ? Does it cache data somewhere else ?
Thanks :)
Upvotes: 1
Views: 1002
Reputation: 469
Don't look for the image with finder - delete it within Xcode.
Yes, the method [UIImage imageNamed] is where the app is searching the bundle for preloaded images. As a rule of thumb, manage your files, groups, folders... with Xcode, not finder.
Look in your project target build phases wether the file is still "there" as a "copy bundle resource".
Upvotes: 2