views:

241

answers:

1

Using MontoTouch for .NET C# iPhone development. (though should not matter)

In the iPhoneSimulator, I use UIImage.FromFile (@"images/Bahai.png"); to get the Bahai.png from the images folder.

However, when I run it in debug mode on my iTouch, the function returns a null.

Only if I put the image file in the root does it work in the iTouch.

Is there a different relative path I need to use?

Ian

+2  A: 

Not sure if this will help, but in objective-C, I would load an image from the app bundle like this:

UIImage *image = [UIImaged imageNamed:@"Bahai.png"];

For other types of files, I would get the absolute path like this:

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Bahai" ofType:@"png"];
gerry3