0

您如何尝试将照片保存到我创建的目录中

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;


    NSArray *directoryNames = [NSArray arrayWithObjects:@"tops",@"bottom",@"right",@"left",nil];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder

    for (int i = 0; i < [directoryNames count] ; i++) {
        NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:directoryNames[i]];
        if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
            [[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:nil]; //Create folder
    }
}

我让用户在应用程序内拍照,并希望用户选择他想保存到哪个目录。我该怎么做?

4

0 回答 0