Class

NSNotificationCenter

An NSNotificationCenter object (or simply, notification center) provides a mechanism for broadcasting information within a program. An NSNotificationCenter object is essentially a notification dispatch table.

Overview

Objects register with a notification center to receive notifications (NSNotification objects) using the addObserver:selector:name:object: or addObserverForName:object:queue:usingBlock: methods. Each invocation of this method specifies a set of notifications. Therefore, objects may register as observers of different notification sets by calling these methods several times.

Each running Cocoa program has a default notification center. You typically don’t create your own. An NSNotificationCenter object can deliver notifications only within a single program. If you want to post a notification to other processes or receive notifications from other processes, use an instance of NSDistributedNotificationCenter.

Symbols

Managing Notification Observers

- addObserverForName:object:queue:usingBlock:

Adds an entry to the receiver’s dispatch table with a notification queue and a block to add to the queue, and optional criteria: notification name and sender.

- addObserver:selector:name:object:

Adds an entry to the receiver’s dispatch table with an observer, a notification selector and optional criteria: notification name and sender.

- removeObserver:

Removes all the entries specifying a given observer from the receiver’s dispatch table.

- removeObserver:name:object:

Removes matching entries from the receiver’s dispatch table.

Posting Notifications

- postNotification:

Posts a given notification to the receiver.

- postNotificationName:object:

Creates a notification with a given name and sender and posts it to the receiver.

- postNotificationName:object:userInfo:

Creates a notification with a given name, sender, and information and posts it to the receiver.

Type Properties

Relationships

Inherits From