Which one is better to use to flow the data from one class to another in the whole project?
NSInvocation
NSNotificationCentre
delegate
methods
or by any other methods i am unaware of ??
They all exist because they all serve different purposes. Briefly:
NSInvocation
Abstract message send to one object, with optional parameters, represented as an object. Not used very often, particularly since the introduction of blocks.
May also be used as a convenient way to avoid creating an NSOperation
subclass (see NSIvocationOperation
).
NSNotificationCenter
Broadcast a message to any number of unknown 'listeners'. One to many. Broadcaster need not know about listeners. Includes a user info dictionary for supplemental information. The most heavyweight/slowest of the lot -- not needed frequently, but seen often for convenience.
Delegates are sufficient substitutes in many cases.
delegate methods
Typically an abstract object which typically adopts a specific protocol. One to one relationship. Common means to handle an action rather than subclassing.
or by any other methods i am unaware of ??
Blocks (^)
can also be used as callbacks/handlers and often as a more typesafe replacement for NSInvocations.