- (void)mouseDown:(NSEvent *)theEvent not firing
Frage
I have got :
- myViewController.m
- myViewController.h
- myView.xib
In myViewController.m, I added the following :
- (void)mouseDown:(NSEvent *)theEvent {
NSLog(@"mouseDown: entered");
}
When I click somewhere on the view (myView.xib), I never enter the mouseDown: method... Do you know why ?
Thanks a lot for your help !!
Lösung
You need to implement mouseDown:(NSEvent *)theEvent
method inside a class (e.g., MyView
) that inherits from NSView
(or NSResponder
to be precise). Then set the class of the View in the xib file to the class you just created.
In general, class names start with a capital letter.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow