I have made a custom NSView
and have implemented the keyDown:
method. However, when I press keys the method is never called. How can I receive those event ? I had override keyDown:
method in my custom view
- (void)keyDown:(NSEvent *)theEvent
{
NSString *theUpArrow = [NSString stringWithFormat:@"%c",NSUpArrowFunctionKey];
NSLog(@"get key : %@",theUpArrow);
}
and also create method in subclass of NSView
like
- (BOOL) acceptsFirstResponder
{
return YES;
}
- (BOOL) becomeFirstResponder
{
return YES;
}
- (BOOL) resignFirstResponder
{
return YES;
}
also I called method there of above method when initWithFrame:
but not getting keyEvent:
on this view
I am new in mac developing i was read most doc for that but still helpless.
So please correct my mistake if any and giving me some hint to how i will get keydown event on my custom view.