KAR KAR - 1 year ago 96
Objective-C Question

Display image from path in imageView in ios

I have image path and I want to display it in uiimageview,


How can I get image to displayed?

Answer Source

Try using below code:

Get image path from Image name:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *imageFilePath;
NSError *err;

imageFilePath = [documentsDirectory stringByAppendingPathComponent:@"Small-m‌​ario.png"];

Set image using imageWithContentsOfFile method:

YourImageView.image = [UIImage imageWithContentsOfFile: imageFilePath]; 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download