I want to create a sub folder to store the images which is captured by camera & also require to store images in to the database and retrieve the images From the database.
So please provide me help regarding how to create a folder开发者_Python百科 in iPhone & how to store the images in to the database & retrieve them
To create a directory in the documents folder,
- (void)createDirectoryInDocumentsFolderWithName:(NSString *)dirName {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *yourDirPath = [documentsDirectory stringByAppendingPathComponent:dirName];
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL isDir = YES;
BOOL isDirExists = [fileManager fileExistsAtPath:yourDirPath isDirectory:&isDir];
if (!isDirExists) [fileManager createDirectoryAtPath:yourDirPath withIntermediateDirectories:YES attributes:nil error:nil];
}
精彩评论