开发者

Issue with UIImage files not being found on phone

开发者 https://www.devze.com 2022-12-25 19:28 出处:网络
Note: Using Monotouch. I have a directory called Images where I have all my PNG files. In my code I have the following

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号