Hi all,
I have a button on my view. I want to display an image as the background on it. The image is previously stored on the memory by the same application.
`NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *uniquePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:"Image.jpg"]; UIImage *image = [UIImage imageWithContentsOfFile: uniquePath];
[btnImage setBackgroundImage:image forState:UIControlStateNormal];`
Every-time I execute the code, the application crashes after the end of the method that contains the above code. I tried debugging, and found that every step executes perfectly, but the application crashes at the end. I guess that problem is with setting the image as the button background. Can anyone help me out of this??
Thanks in advance
P.S i am writing the above code in viewDidLoad method.