toto_tata
toto_tata

Reputation: 15432

- (void)mouseDown:(NSEvent *)theEvent not firing

I have got :

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

Upvotes: 1

Views: 1972

Answers (1)

goetz
goetz

Reputation: 916

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.

Upvotes: 4

Related Questions