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 !!

War es hilfreich?

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
scroll top