What's the difference between data source and delegate?

后端 未结 6 698
离开以前
离开以前 2020-11-28 07:02

I have a fundamental question related to Cocoa frameworks design patterns.

What\'s the difference between delegate and data source?

Both of them cou

6条回答
  •  醉梦人生
    2020-11-28 07:41

    The datasource supplies the data, the delegate supplies the behavior.

    In MVC, datasource is in the model layer and the delegate is in the control layer.

    Actually, on second thought, the datasource is usually controller that is lower down, closer to the model. I don't think I've ever used a model object as my datasource.

提交回复
热议问题