I try to set an image for a UIButton from documents directory
i tried this:
-(IBAction) vignettesBank1:(id)sender {
NSString *localPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *imageBouton1 = [localPath stringByAppendingPathComponent:[[NSString alloc]initWithFormat:@"btn01.png"]];
[boutonVideo1 setImage:[UIImage imageNamed:imageBouton1] forState:UIControlStateNormal];
NSLog(@"imageBouton1=%@",imageBouton1);}
log return : imageBouton1=/var/mobile/Applications/164F9A40-10AF-402E-A46C-73084CAA8627/Documents/btn01.png
i try this too :
-(IBAction) vignettesBank1:(id)sender {
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
NSString *pngfile = [documentsDir stringByAppendingPathComponent:@"btn01.png"];
[boutonVideo1 setImage:[UIImage imageNamed:pngfile] forState:UIControlStateNormal];
NSLog(@"imageBouton1=%@",pngfile);}
log return the same : imageBouton1=/var/mobile/Applications/164F9A40-10AF-402E-A46C-73084CAA8627/Documents/btn01.png
my button doesn't load my image thank's for your help