Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8277185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:36:49+00:00 2026-06-08T08:36:49+00:00

I would like to be conform with pattern MVC and i ask me, where

  • 0

I would like to be conform with pattern MVC and i ask me, where the “cellForRowAtIndexPath” method must to go :/
Because, at the moment, this method is in the Controller File.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:36:51+00:00Added an answer on June 8, 2026 at 8:36 am

    You’re asking whether it should be in the Model (M) or Controller (C), I assume. And it’s an interesting question, because UITableView has two protocols:

    UITableViewDelegate
    UITableViewDataSource
    

    Well, the UITableViewDelegate protocol is for the ‘owner’ of the view, which would be generally the Controller – I haven’t seen any code that assumes otherwise.

    So then where should the UITableViewDataSource sit? This is the protocol that defines

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    

    Now, if the Apple developers assumed it would go in the Controller, why not just incorporate it into the UITableViewDelegate protocol? The documentation says this (with my bold):

    The UITableViewDataSource protocol is adopted by an object that
    mediates the application’s data model for a UITableView object
    . The
    data source provides the table-view object with the information it
    needs to construct and modify a table view.

    As a representative of the data model, the data source supplies
    minimal information about the table view’s appearance. The table-view
    object’s delegate—an object adopting the UITableViewDelegate
    protocol—provides that information.

    So that seems to suggest it should sit in the model – but really by saying “mediates the application’s data model” it means it should sit in a Controller – but perhaps not the same controller that actually manages the UITableView (via the UITableViewDelegate protocol). It seems to me you have the flexibility to look at laying this out in a couple of different ways – however the general conclusion is that in 99% of the code I’ve seen it sits in the Controller which also is also the UITableViewDelegate delegate.

    Here’s some Apple documentation on MVC: http://developer.apple.com/library/mac/documentation/General/Conceptual/CocoaEncyclopedia/Model-View-Controller/Model-View-Controller.html#//apple_ref/doc/uid/TP40010810-CH14-SW9

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What would a simple unit test look like to confirm that a certain controller
Would like to parse IPv4 address from exit-addresses . Format of the file: ExitNode
I would like to continue the discussion from this post: GPX Schema validation problems
I would like to place a comment ( <!-- this --> style) at the
I have a ~700 MB binary file (non-text data); what I would like to
With Scala's pattern matching I would like to confirm not only that two String
I would like to confirm whether I am on the right track when identifying
I imagine two, but I would like to confirm if I am making sense
I have a confusion regarding DataContext which i would like someone to confirm or
I have a RadioButtonList control and I would like to do a Javascript confirm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.