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

NSNotificationCenter

The NSNotificationCenter is the brains of the operation. It allows you to do three things: register observer objects, post notifications, and unregister observers.

Here are some commonly used methods implemented by NSNotificationCenter:

c​l​a​s​s​ ​f​u​n​c​ ​d​e​f​a​u​l​t​C​e​n​t​e​r​(​)​ ​-​>​ ​N​S​N​o​t​i​f​i​c​a​t​i​o​n​C​e​n​t​e​r​

Returns the notification center.

f​u​n​c​ ​a​d​d​O​b​s​e​r​v​e​r​(​o​b​s​e​r​v​e​r​:​ ​A​n​y​O​b​j​e​c​t​,​
 ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​s​e​l​e​c​t​o​r​ ​a​S​e​l​e​c​t​o​r​:​ ​S​e​l​e​c​t​o​r​,​
 ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​n​a​m​e​ ​a​N​a​m​e​:​ ​S​t​r​i​n​g​?​,​
 ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​o​b​j​e​c​t​ ​a​n​O​b​j​e​c​t​:​ ​A​n​y​O​b​j​e​c​t​?​)​

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