문제

In my OS X App, how can I change the NSTextField focus by pressing the Enter key instead of pressing the Tab key?

도움이 되었습니까?

해결책

You may use NSText - (void)textDidEndEditing:(NSNotification *)aNotification delegate method, where you should use NSWindow’s makeFirstResponder: to change the current first responder. See the NSResponder class reference for details on this.

First set delegate of your firs textField to self. Then in same class:

- (void)textDidEndEditing:(NSNotification *)aNotification {
     NSLog(@"delegate method");
    [self.window makeFirstResponder:[[[aNotification object]window]nextResponder]];
}

I assume that you do this in AppDelegate class.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top