前端之家收集整理的这篇文章主要介绍了
objective-c – 显示文件选择器对话框,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何在Mac OS X上
显示文件选择器对话框?语言是Objective C.
@H_
403_5@
你
搜索的是“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.
}
}