UIImage only loads on iPhone if I change file name to lowercase
I have an image that changes due to a button press. I have the code set up like this:
UIImage *example = [UIImage imageNamed: @"Example.png"];
UIImage *stuff = [UIImage imageNamed: @"Stuff.png"];
UIImage *bob = [UIImage imageNamed: @"Bob.png"];
UIImage *thing = [UIImage imageNamed: @"thing.png"];
It used to be so that the last image was Thing.png and not thing.png. This was because thing would load on iphone simulator but not the device. I saw a question on here that said it may be because the iphone filing system is case sensitive, so I changed it to lowercase. It then worked. What I don't understand is that in the resources folder it is called Thing.png, not thing.png, and it is like that in finder as well. So why did it need to be changed, especially if al开发者_如何学Gol the other images loaded just fine?
Did you try cleaning the solution and then changing the name back?
When something like that happens I usually remove the app from the phone, clean all targets, Empty XCode cache and delete the build folder.
In this case it would also be worth deleting the file from the project in Finder, then deleting it from XCode (it should appear red) and finally re-add it.
精彩评论