Issue with UIImage files not being found on phone
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 fin开发者_如何学Ce, 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
Add your Bundle's path to the full path using Path.Combine(bundlepath, "images/MinusDark.png")
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.
精彩评论