2010-12-04 86 views

回答

3

將其作爲模式窗口而不是作爲工作表運行。

+0

完美,這正是我需要的。 – David 2010-12-04 07:13:07

1

在你的狀態項的IBAction爲方法,稱之爲:

window = [[NSApp currentEvent] window]; 

然後,您可以通過該窗口NSOpenPanel的beginSheetModalForWindow:completionHandler:爲了顯示開啓面板如紙。

您可能會發現狀態項本身會捲曲並隨着工作表出現消失,但當您關閉工作表時它會再次出現。

0

您可以簡單地從NSMenuItem的行動打電話給你打開面板:

NSOpenPanel *panel = [NSOpenPanel openPanel]; 
    [panel setAllowsMultipleSelection:YES]; 
    [panel setCanChooseDirectories:YES]; 

    NSUInteger result = [panel runModal]; 
    NSMutableArray *paths = [NSMutableArray array]; 

    if(result == NSFileHandlingPanelOKButton) { 
     for (NSURL *url in [panel URLs]) { 
      NSLog(@"%@", url); 
     } 
    } 
相關問題