- (void)mouseDown:(NSEvent *)theEvent not firing
Domanda
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 !!
Soluzione
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.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow