0

NSTextField の場合: up_key を押すと、カーソル位置が NSTextField のテキストの先頭に移動します。しかし、カーソル位置を維持する必要があります。始まらない。

私はこのコードを使用しようとします:

-(void)keyUp:(NSEvent *)theEvent
{
    [[myTextField currentEditor] moveToEndOfLine:nil];
}    

しかし、このコードを介して、カーソル位置が始まりの終わりに移動してから終わりに移動することがわかります。

何か考えはありますか?

4

1 に答える 1

1

私は解決策を見つけました:

- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
{
    if( [NSStringFromSelector(command) isEqualToString:@"moveUp:"] )
    {
        return YES;
    }

    return NO;
}
于 2013-07-19T05:42:52.043 に答える