iOS NSNotifications

NSNotifications is a way to message other classes and objects within iOS. Unlike protocols and delegates, NSNotifications are blind in that they do not directly know which objects and methods are responding to their messages. This allows different parts of the code to be independent and not coupled which can be a very good thing. The passing of the notification is handled by he Notification center which each thread shares.

Register a Message

Post a Message


postNotificationName: simply the name of the notification
object: any object may be passed with the notification, normally this is the sender

Cleanup of the registration should be done in the dealloc method.

Tags: , , , ,

Comments are closed.

Search

Websites

  • slide
  • slide
  • slide
  • slide