views:

75

answers:

2

Note: Using Monotouch. I have a directory called Images where I have all my PNG files. In my code I have the following

_imgMinusDark = UIImage.FromFile("images/MinusDark.png");

On the simulator it runs fine, on the phone it's null. I have the Images folder content (all the PNGs) in my MonoDevelop marked as Content in terms of Build Action.

What am I missing?

thanks

A: 

Don't know if this is the case for Mono, but with standard UIKit the imageNamed method is case sensitive on the device and case insensitive on the simulator, which can lead to the exact problem you're describing.

Ian Henry
I double checked that my case is the same. Thanks though.
Driss Zouak
Is this happening for all of your images, or just the one? Could it be that Mono expects a backslash instead of a forward slash? Only other thing I can think of...
Ian Henry
This is happening for all my images when deployed to the phone. The slash thing is / and is used for both the phone and simulator. Simulator it's fine, iPhone it isn't.
Driss Zouak
+1  A: 

Add your Bundle's path to the full path using Path.Combine(bundlepath, "images/MinusDark.png")

BahaiResearch.com