Question

  1. Create new 10.8 project.
  2. In Appdelegate.m after this code

    • (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application }

I add

- (void)mouseDown:(NSEvent *)event{

    NSLog(@"Hi");

}

But i am not getting the event's triggered

My Question is what should i do in Appdelegate.m so that when a user clicks on the Window the mouseDown event gets triggered?

Was it helpful?

Solution

  1. Create a subclass of NSView. Then just paste that code in the .m file.
  2. Click on your Xib window. Open Document Outline drawer and make sure that its View is selected. Then go to the sidebar to the right and click on the identity inspector. Then enter the name of the subclass you've created in the Class field.

That's much it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top