cocoa Key Event Handling docs を読みました。次のようなコード スニペットの例を取得します。問題は、英語以外の入力方法 (中国語など) を変更した場合です。コード スニペットは機能しません。単一のアルファベット文字は返されますが、Unicode の漢字は返されません。提案またはドキュメントの一部が欠けていますか?
- (void)keyDown:(NSEvent *)theEvent
{
[self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
}
// The following action methods are declared in NSResponder.h
- (void)insertTab:(id)sender
{
if ([[self window] firstResponder] == self)
{
[[self window] selectNextKeyView:self];
}
}
- (void)insertBacktab:(id)sender
{
if ([[self window] firstResponder] == self)
{
[[self window] selectPreviousKeyView:self];
}
}
- (void)insertText:(id)string
{
[super insertText:string]; // have superclass insert it
}