2011-08-10 42 views
3

我有一個菜單欄應用程序,它打開了一個popover。該彈出包含NSTextField和幾個按鈕。問題在於NSTextField是不可選的,不可能在其中輸入任何內容。但是,可以用鼠標右鍵點擊它並粘貼一些東西。那麼,這絕對是奇怪的行爲。按鈕工作沒有任何問題,在彈出,順便說一句。NSTextField在NSPopOver中不活躍

下面的代碼我使用:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification 
{ 
    [NSApp activateIgnoringOtherApps:YES]; 
    statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength] retain]; 
    [statusItem setAction:@selector(showPopOver:)]; 
    [statusItem setImage:[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"icon" ofType:@"png"]]]; 
    [statusItem setHighlightMode:YES]; 
} 

和:

- (IBAction)showPopOver:(id)sender { 
    popover = [[NSPopover alloc] init]; 
    [popover setContentViewController:popOverController]; 

    popover.animates = YES; 
    popover.delegate = self; 

    [popover showRelativeToRect:[sender bounds] 
          ofView:sender 
        preferredEdge:NSMaxYEdge]; 

    } 
} 

任何想法是什麼問題究竟如何解決?

+0

Balazs Toth在這個問題中發現了修復:http://stackoverflow.com/questions/7214273/nstextfield-on-nspopover/7794324#7794324 – suda

回答