mardi 1 juillet 2014

Doubts in NSNotification in Swift


Vote count:

0




I am developing my very first app for iOS and not understanding notifications.


I am sending notifications as:



DefaultCenter.postNotificationName("evRodadaAtualizei", object: nil)


In another class, I have a method that observes this notification:



DefaultCenter.addObserver(self, selector: Selector("Atualizar"),
name: "evRodadaAtualizei", object: nil)


My question is:


This observer will listen any notification with that name? It is not important the class where notification was declared? In other words, is possible to have a place to put all the notifications (like a notification library), because all of them are independent of the class?


If I am understanding correctly, this is very different of the concept of events in C# or VB.Net where events belongs to classes.



asked 28 secs ago

Nizam

448





Aucun commentaire:

Enregistrer un commentaire