I've been searching for answers to this question and while I have done the steps I still cannot seem to get the mouseDown method to be called. What I want is when the user clicks and holds down on the image, it should print out "Mouse down!". (Eventually what I want to do is the user to click and hold on the image to cause a sound to play, and when they let go the sound will stop).
Here's what I have. My header:
@interface MyNSImageView : NSImageView <NSImageDelegate> {
}
@end
And my class:
@implementation MyNSImageView
- (void)mouseDown:(NSEvent *)event {
if ([[self target] respondsToSelector:[self action]]) {
[NSApp sendAction:[self action] to:[self target] from:self];
}
NSLog(@"Mouse Down!");
}
@end
Does this look right? If so, then are there other problems which might be interfering with it? Of not, what should I do?
Thanks heaps!