views:

20

answers:

1

I retrieve an image I have saved at the documents directory like this:

//set background image
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder
NSString *imagePath = [documentsDirectory stringByAppendingPathComponent:@"/myFolder/back.png"];
            backgroundImage.image =[UIImage imageWithContentsOfFile:imagePath];

But it is not shown :(

What am I doing wrong?

PD:Yes, it has been saved with the same path and filename (no upper/lower case differences) and yes, I tried opening the image at that path and it works.

Thanks in advance!

A: 

It was being done in the wrong place. I was doing it at init instead of viewDidLoad.

dkk