What's the difference between data source and delegate?

后端 未结 6 710
离开以前
离开以前 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:22

    From my point of view, a DataSource is an object that doesn't know where the data is, and thus you should provide it. Such as telling an object how many items in a column.

    A Delegate, which is a part that object shows to you, must be implemented by your class, because the object knows where the data is, but it does not know how to use it correctly.

提交回复
热议问题