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)
        {            
            //点击确定后的代码
            ...
        }
        
    }];

 

posted @ 2013-02-03 21:54  静候良机  阅读(1052)  评论(0编辑  收藏  举报