2011-01-27 72 views
1

我有一個NSTextView,我把委託給我的文件所有者。然後,我的文件所有者會與我在視圖中做不同的事情的課程相關聯。NSTextView委託不工作?

據我的理解,現在應該可以從我的類中的NSTextView中捕獲事件(因爲我已將它的委託設置爲文件所有者),但似乎沒有工作,爲什麼?

我已經實現了這個功能在我的課:根據http://developer.apple.com/library/mac/#documentation/cocoa/Reference/NSTextViewDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/NSTextViewDelegate

方法簽名

- (BOOL)control: (NSControl *)control textView:(NSTextView *)textView doCommandBySelector: (SEL)commandSelector { 

    NSLog(@"i was fired!"); 

    return YES; 
} 

回答

1

的樣子:

- (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)aSelector 

給一個嘗試吧。

+0

嘿謝謝你的鏈接,我不知道那個代表:-) – 2011-01-28 09:22:09

1

選擇器只是textView:doCommandBySelector:;放下control

+0

謝謝你做的伎倆! – 2011-01-28 09:21:51