R – iPhone – Loading local images from a local xml file

iphonelocalresources

How come I can load a local xml file from the main bundle, but I can't load images?

NSString *path = [[NSBundle mainBundle] resourcePath];

This gets loaded (i know because I can trace it)
/Users/me/Library/Application Support/iPhone Simulator/User/Applications/5B888456-40FF-4C72-A2ED-5D5CFA287777/MyApp.app/test.xml

This image never loads (nor does any image):
/Users/me/Library/Application Support/iPhone Simulator/User/Applications/5B888456-40FF-4C72-A2ED-5D5CFA287777/MyApp.app/background.png

Best Answer

You can use [UIImage imageNamed:@"background.png"].

This will load background.png (which should be located in your Resources folder in Xcode).

Related Topic