NST
NST

Reputation: 125

IOS - how to retrieve image path from SQLite and show it in UIamgeView

I have an SQLite database with an image column that i store image paths in it, and I attached the images in the project folder.
Now I want to retrieve these image paths and show the images in UImageView How can I do that using objective-c?

Upvotes: 0

Views: 579

Answers (1)

Mital Solanki
Mital Solanki

Reputation: 171

Suppose in your Project Folder, You have 3 Images like a.png, b.png and c.png and You are save imagePath like this.

[[NSBundle mainBundle] pathForResource:@"a" ofType:@"png"]

we are getting imagePath from Database like below:

NSString *strImagePath = @"/var/mobile/Applications/BCFC4543-85BD-4B3D-8334-E4B6A05BA2E9/Test.app/a.png";

UIImage *aImage = [UIImage imageWithContentsOfFile:strImagePath];

aImageView.image = aImage;

It's working Fine.

Upvotes: 2

Related Questions