iphone - What is the purpose of NSNotification?

  1. Can you please explain what is the purpose of the NSNotification, and what are some situations I could use it?

  2. Does a notification call all classes in the app, or does it call a specific class, by passing a delegate?

  3. Is it possible to create 1 notification, and receive it on multiple classes?

Answers


  1. Using NSNotification you can notify multiple objects about some event and you can do that not caring about which objects and how many of them are listening for that notification.

  2. NSNotification passes through NSNotificationCenter object that is responsible for getting notifications from objects who create them (using postNotification: functions family) and sending them to the objects who are registered to listen to specific notification (to receive notification object must register in NSNotificationCenter using addObserver: functions)

  3. Notification can be observed by multiple objects - all of them must just register in NSNotificationCenter,


Need Your Help

cannot curl from tcl (eggdrop bot) after restart freebsd/freenas-jail

curl cron tcl eggdrop

I am running a freenas jail environment that run a few eggdrop scripts.

Confirmation, Developer and Personal Separate FB accounts allowed

facebook

I need to know if it's possible to use a separate Facebook account to my personal one for building apps (i'd rather not fill my personal account with development spam). Facebook's terms of agreemen...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.