What's the difference between data source and delegate?

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

    To make it short:

    Delegate relates to the UI and User actions against the cells and table.

    common methods: willSelectRow, didSelectRow, willDisplay, heightForRow, willBeginEditingAt

    Data Source deals with the editing, population and displaying of data on the tableview.

    common methods canEditRowAt, commit, titleForHeaderInSection, cellForRowAt, numberOfSections, sectionIndexTitles

提交回复
热议问题