I subclass a NSTextField and in subclass use an event method (keyUp),i want to call a method in main view (view that i put NSTextFiled on it) when user push Enter key.i use below code but don’t how to call specific method in main view
- (void)keyUp:(NSEvent *)theEvent
{
NSString *theArrow = [theEvent charactersIgnoringModifiers];
unichar keyChar = 0;
keyChar = [theArrow characterAtIndex:0];
if ( keyChar == NSEnterCharacter )
{
//call method that exist in main view
}
}
1.in main view set :
textField.delegate=self;2.add
<NSTextFieldDelegate>to mainview.h and subclass.h3.use this code Instead of comment
4.implement this method in mainview.m