开发者

Creating a directory in the iPhone

开发者 https://www.devze.com 2023-02-25 01:16 出处:网络
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 imagesFrom the database.

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];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号