0
如何編碼按鈕以啓動Mac上文件的搜索,以便用戶可以選擇文件?該程序將要求用戶選擇他將要發送到外部設備的文件。指定按鈕在Cocoa中搜索計算機文件
如何編碼按鈕以啓動Mac上文件的搜索,以便用戶可以選擇文件?該程序將要求用戶選擇他將要發送到外部設備的文件。指定按鈕在Cocoa中搜索計算機文件
聽起來像你想使用NSOpenPanel
(reference)來允許用戶選擇一個文件。
你使用這樣的:
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
// Configure the panel if necessary using openPanel.whatever = something;
NSInteger result = [openPanel runModal];
if (result == NSOKButton)
{
NSURL *url = openPanel.URL;
NSAssert(url.isFileURL, @"Expected a file!");
NSString *filename = url.path;
}
也許你正在尋找的(https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ [NSOpenPanel類?] ApplicationKit /班/ NSOpenPanel_Class /參考/的reference.html) – sgress454 2012-08-14 20:40:04