Reputation: 412
I have a path problem with UIImage.FromFile()
method. My solution folder has 3 projects and the main UI project has an Images
folder in it. I put all my project images in this folder and I have code like this:
UIImage myImg = UIImage.FromFile("Images/someImage.png");
I have already examined this and all these topics..
I set images property of build to "content" and etc..
Can you help me:
Upvotes: 8
Views: 7853
Reputation: 89102
The very first question you linked to has the solution - you need to use Unix style paths ("/"), not DOS/Windows paths ("\").
You should also carefully check the casing of your paths - the emulator is more forgiving of incorrect case than the actual device is.
Finally, look inside of your .app bundle to verify that the image files are really where you think they are, relative to the root of the bundle.
Upvotes: 2
Reputation: 28187
Generally, if you have right clicked on the file, gone to it's properties and marked it as Content
then the following will work:
UIImage myImg = UIImage.FromFile(@"Images/someImage.png");
Upvotes: 12