title: Objective-c: NSButton setAction not working
body: <p>I'm making a couple of buttons programmatically and trying to set an action to each but I can't seem to get it to work. </p>
  
  <p>In my AppController.h I have this code: </p>
  
  <pre><code>...
  IBOutlet NSButton* btnZoomIn;
  IBOutlet NSButton* btnZoomOut;
  ...
  </code></pre>
  
  <p>and</p>
  
  <pre><code>- (IBAction) zoomIn : (id) sender; 
  
  - (IBAction) zoomOut : (id) sender;
  </code></pre>
  
  <p>and in AppController.m within the awakeFromNib method: </p>
  
  <pre><code>/*zoom in and out buttons*/
  
  //get the path to the image files
  NSString* zoomInImgPath = [[NSBundle mainBundle] pathForResource:@"zoomIn" ofType:@"png"];
  NSString* zoomOutImgPath = [[NSBundle mainBundle] pathForResource:@"zoomOut" ofType:@"png"];
  
  //declare the NSImages
  zoomInImg = [[NSImage alloc] initWithContentsOfFile:zoomInImgPath];
  zoomOutImg = [[NSImage alloc] initWithContentsOfFile: zoomOutImgPath];
  
  //button making!
  //zoomIn
  btnZoomIn = [[NSButton alloc] initWithFrame:NSMakeRect(1426.0, 920.0, 25.0, 25.0)];
  [btnZoomIn setButtonType:NSMomentaryPushInButton];
  [btnZoomIn setTitle:@""];
  [btnZoomIn setToolTip:@"Zoom In"];
  [btnZoomIn setImage:zoomInImg];
  [btnZoomIn setAction:@selector(zoomIn:)];
  [[mainWin contentView] addSubview:btnZoomIn];
  
  //zoomOut
  btnZoomOut = [[NSButton alloc] initWithFrame:NSMakeRect(1456.0, 920.0, 25.0, 25.0)];
  [btnZoomOut setButtonType:NSMomentaryPushInButton];
  [btnZoomOut setTitle:@""];
  [btnZoomOut setToolTip:@"Zoom Out"];
  [btnZoomOut setImage:zoomOutImg];
  [btnZoomOut setAction:@selector(zoomOut:)];
  [[mainWin contentView] addSubview:btnZoomOut];
  </code></pre>
  
  <p>and </p>
  
  <pre><code>- (IBAction) zoomIn : (id) sender  { 
      NSLog(@"zoom in!");
   }
  
   - (IBAction) zoomOut : (id) sender { 
      NSLog(@"zoom out!");
   }
  </code></pre>
  
  <p>but zoomOut and zoomIn do not get hit...</p>