解决方法
你搜索的是“NSOpenPanel”,这里有一个例子如何使用:
- 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.
- }
- }