O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

For the More Curious: Which Object Sends the Action Message?

The target on the Cut, Copy, and Paste menu items is nil. Sending a message to nil will not do anything. All target-action messages are handled by NSApplication. It has the following method:

 ​ ​ ​ ​f​u​n​c​ ​s​e​n​d​A​c​t​i​o​n​(​_​:​ ​S​e​l​e​c​t​o​r​,​ ​t​o​:​ ​A​n​y​O​b​j​e​c​t​!​,​ ​f​r​o​m​:​ ​A​n​y​O​b​j​e​c​t​!​)​ ​-​>​ ​B​o​o​l​

When the target is nil, NSApplication knows to try to send messages to the objects in the responder chain.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required