Mac 调用打开文件对话框 NSOpenPanel

    // Create and configure the panel.
    NSOpenPanel* panel = [NSOpenPanel openPanel];
    [panel setCanChooseDirectories:NO];
    [panel setAllowsMultipleSelection:NO];
    [panel setMessage:@"Import one or more files or directories."];
    
    // Display the panel attached to the document's window.
    [panel beginSheetModalForWindow:window completionHandler:^(NSInteger result){
        if (result == NSFileHandlingPanelOKButton)
        {            
            //点击确定后的代码
            ...
        }
        
    }];
原文地址:https://www.cnblogs.com/iihe602/p/2891158.html