tags:

views:

146

answers:

1

I am simply creating a student management system in iPhone.

There I need to store student's small images,

Which should be appear in tableView,

Ok, I know how to work with tableView... how to work with database...

But question is

Where to store images how can we obtain the path of stored images..

Do i have to store entire images to database...

Or

i have to store relative path of image to database...

What is suggested by You masters?

Thanks in advance for helping me.

+1  A: 

You can create image files on the file system of the device in the Document directory. Use something like this:

// Generate a unique user filename
NSString *imageFilename = [NSString stringWithFormat:@"student_image_%@", uniqueIdentifier];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [NSString stringWithFormat:@"%@/%@", [paths objectAtIndex:0], imageFilename];

NSData *storage = [image UIImagePNGRepresentation]; // or UIImageJPEGRepresentation

[storage writeToFile:path atomically:NO];

Best Regards,

Matt Long