objective-c – 显示文件选择器对话框

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

解决方法

搜索的是“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.
    }
}
原文链接:https://www.f2er.com/c/112601.html

猜你在找的C&C++相关文章