Vit
Vit

Reputation: 936

How can do functionality of notify for controller?

I use MVC pattern . I've UIView, CuctomViewController and ModelOfCuctomViewController.

ModelOfCuctomViewController creates data for my CuctomViewController and take data from some web server because I've small delay. The question is. How can I notify CuctomViewController after update of ModelOfCuctomViewController.

I'm usingKVC pattern for notify my controller about some changes in model now. And I can use NSNotification.

Maybe, Does somebody know another options functionality for notify controller?

Upvotes: 0

Views: 38

Answers (1)

Antonio MG
Antonio MG

Reputation: 20410

I think the prefered way of doing this is using NSNotifications, but KVC or protocol/delegate are good approaches too. I don't think Apple stablishes anything in particular.

Communication: User actions in the view layer that create or modify data are communicated through a controller object and result in the creation or updating of a model object. When a model object changes (for example, new data is received over a network connection), it notifies a controller object, which updates the appropriate view objects.

Upvotes: 1

Related Questions