delegates - Notification Center vs. Delegation in iOS SDK -
why did apple choose use delegation communication amongst sdk objects , post notifications notification center others?
in particular, i'm thinking set of keyboard appearance notifications come uiwindow.
is because notification center system means more 1 object can use keyboard appearance action trigger change state, whereas 1 object have been able act delegate implementation?
delegation allows execute methods (and pass parameters) 1 class another. allows method fired when class not imported. delegation allows multiple view controllers (or otherwise classes) fire methods in single view controller.
notification center, on other hand, listens , waits until hears message waiting for. allows multiple listeners in multiple view controllers wait , listen given message.
you delegation 1/many 1 relationship while notification center 1/many 1/many relationship.
Comments
Post a Comment