Skip to content

Instantly share code, notes, and snippets.

@katsuhide
Created July 5, 2013 16:00
Show Gist options
  • Save katsuhide/5935495 to your computer and use it in GitHub Desktop.
Save katsuhide/5935495 to your computer and use it in GitHub Desktop.
FileChooser
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseFiles:NO];
[panel setCanChooseDirectories:YES];
[panel setAllowsMultipleSelection:YES]; // yes if more than one dir is allowed
NSInteger clicked = [panel runModal];
if (clicked == NSFileHandlingPanelOKButton) {
for (NSURL *url in [panel URLs]) {
// do something with the url here.
NSLog(@"url:%@", [url path]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment