Pergunta

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

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top